Commit bb2c6b21 authored by Adam Cozzette's avatar Adam Cozzette Committed by GitHub

Merge pull request #2505 from ckennelly/master

Remove spurious NULL checks in ArenaStringPtr::CreateInstance.
parents fb15862b ba63fa73
......@@ -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);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment