diff options
author | Ludger Sprenker <ludger@sprenker.net> | 2018-01-24 17:14:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-24 17:14:05 +0100 |
commit | 9ab859f5a5bfe414b887af3a692073e5351cdcc0 (patch) | |
tree | b1ac1c967e0a16571f3d12f9eb519256331950c9 /src/google/protobuf | |
parent | 80e016e83898b2bd4f197f1d57c7e1453828e846 (diff) | |
download | protobuf-9ab859f5a5bfe414b887af3a692073e5351cdcc0.tar.gz protobuf-9ab859f5a5bfe414b887af3a692073e5351cdcc0.tar.bz2 protobuf-9ab859f5a5bfe414b887af3a692073e5351cdcc0.zip |
Create std::string in Arena memory
Diffstat (limited to 'src/google/protobuf')
-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..751c0f7a 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) { |