aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@gmail.com>2018-01-31 14:31:58 -0800
committerGravatar GitHub <noreply@github.com>2018-01-31 14:31:58 -0800
commit6456e5d6462e8c3d21d6afd64420dbd028ea3245 (patch)
treed2d16d1e2ba76a00b0f2c99f73c3619c4ae896b7
parentcf016a42e645a0aea2ce0d1027e210157c49016c (diff)
parent14e8852fe483de57d155e7ba129d4c22f4e40279 (diff)
Merge pull request #4239 from mrpi/master
Create std::string in Arena memory
-rwxr-xr-xsrc/google/protobuf/arenastring.h6
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) {