Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: third_party/protobuf/src/google/protobuf/descriptor.cc

Issue 164743002: Replace kEmptyString with OnceInit initialized string* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/descriptor.cc
diff --git a/third_party/protobuf/src/google/protobuf/descriptor.cc b/third_party/protobuf/src/google/protobuf/descriptor.cc
index bcbf1e079f63f832aa4811138be642f070ad04e9..c2bc81a2dd6f87eac01fe2e040ee951869c97710 100644
--- a/third_party/protobuf/src/google/protobuf/descriptor.cc
+++ b/third_party/protobuf/src/google/protobuf/descriptor.cc
@@ -139,8 +139,6 @@ const int FieldDescriptor::kLastReservedNumber;
namespace {
-const string kEmptyString;
-
string ToCamelCase(const string& input) {
bool capitalize_next = false;
string result;
@@ -2757,7 +2755,7 @@ Symbol DescriptorBuilder::NewPlaceholder(const string& name,
placeholder_name = tables_->AllocateString(
placeholder_full_name->substr(dotpos + 1));
} else {
- placeholder_package = &kEmptyString;
+ placeholder_package = &::google::protobuf::internal::GetEmptyString();
placeholder_name = placeholder_full_name;
}
@@ -2843,7 +2841,7 @@ const FileDescriptor* DescriptorBuilder::NewPlaceholderFile(
memset(placeholder, 0, sizeof(*placeholder));
placeholder->name_ = tables_->AllocateString(name);
- placeholder->package_ = &kEmptyString;
+ placeholder->package_ = &::google::protobuf::internal::GetEmptyString();
placeholder->pool_ = pool_;
placeholder->options_ = &FileOptions::default_instance();
placeholder->tables_ = &FileDescriptorTables::kEmpty;
@@ -3485,7 +3483,7 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto,
result->default_value_enum_ = NULL;
break;
case FieldDescriptor::CPPTYPE_STRING:
- result->default_value_string_ = &kEmptyString;
+ result->default_value_string_ = &::google::protobuf::internal::GetEmptyString();
break;
case FieldDescriptor::CPPTYPE_MESSAGE:
break;

Powered by Google App Engine
This is Rietveld 408576698