aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/arenastring.h
diff options
context:
space:
mode:
authorChris Kennelly <ckennelly@google.com>2016-12-15 13:25:26 -0800
committerChris Kennelly <ckennelly@google.com>2016-12-15 14:43:33 -0800
commitba63fa731ec46f776a9bbfd06b94c4c31e8e0e90 (patch)
tree21cc9f8762b3a6422fa4925204a459a817823a3d /src/google/protobuf/arenastring.h
parenta95e38ce8dec20d327692f4f5c2b0d37d6776696 (diff)
downloadprotobuf-ba63fa731ec46f776a9bbfd06b94c4c31e8e0e90.tar.gz
protobuf-ba63fa731ec46f776a9bbfd06b94c4c31e8e0e90.tar.bz2
protobuf-ba63fa731ec46f776a9bbfd06b94c4c31e8e0e90.zip
Remove spurious NULL checks in ArenaStringPtr::CreateInstance.
Diffstat (limited to 'src/google/protobuf/arenastring.h')
-rwxr-xr-xsrc/google/protobuf/arenastring.h15
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);
}
};