diff options
author | Adam Cozzette <acozzette@gmail.com> | 2018-01-31 14:31:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 14:31:58 -0800 |
commit | 6456e5d6462e8c3d21d6afd64420dbd028ea3245 (patch) | |
tree | d2d16d1e2ba76a00b0f2c99f73c3619c4ae896b7 | |
parent | cf016a42e645a0aea2ce0d1027e210157c49016c (diff) | |
parent | 14e8852fe483de57d155e7ba129d4c22f4e40279 (diff) |
Merge pull request #4239 from mrpi/master
Create std::string in Arena memory
-rwxr-xr-x | src/google/protobuf/arenastring.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h index fb1b64a3..2b108616 100755 --- a/src/google/protobuf/arenastring.h +++ b/src/google/protobuf/arenastring.h @@ -322,10 +322,8 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { void CreateInstance(::google::protobuf::Arena* arena, const ::std::string* initial_value) { GOOGLE_DCHECK(initial_value != NULL); - ptr_ = new ::std::string(*initial_value); - if (arena != NULL) { - arena->Own(ptr_); - } + // uses "new ::std::string" when arena is nullptr + ptr_ = Arena::Create< ::std::string >(arena, *initial_value); } GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void CreateInstanceNoArena(const ::std::string* initial_value) { |