diff options
-rwxr-xr-x | src/google/protobuf/arenastring.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h index b60ee379..726c19d4 100755 --- a/src/google/protobuf/arenastring.h +++ b/src/google/protobuf/arenastring.h @@ -283,22 +283,15 @@ struct LIBPROTOBUF_EXPORT ArenaStringPtr { GOOGLE_ATTRIBUTE_NOINLINE void CreateInstance(::google::protobuf::Arena* arena, const ::std::string* initial_value) { - // Assumes ptr_ is not NULL. - if (initial_value != NULL) { - ptr_ = new ::std::string(*initial_value); - } else { - ptr_ = new ::std::string(); - } + GOOGLE_DCHECK(initial_value != NULL); + ptr_ = new ::std::string(*initial_value); if (arena != NULL) { arena->Own(ptr_); } } GOOGLE_ATTRIBUTE_NOINLINE void CreateInstanceNoArena(const ::std::string* initial_value) { - if (initial_value != NULL) { - ptr_ = new ::std::string(*initial_value); - } else { - ptr_ = new ::std::string(); - } + GOOGLE_DCHECK(initial_value != NULL); + ptr_ = new ::std::string(*initial_value); } }; |