Index: third_party/protobuf/src/google/protobuf/arenastring.cc |
diff --git a/third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc b/third_party/protobuf/src/google/protobuf/arenastring.cc |
similarity index 63% |
rename from third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc |
rename to third_party/protobuf/src/google/protobuf/arenastring.cc |
index 1b1ab5d1dc7f4bf986884718c67d69a460232ada..5a22adabcfedd8be981358cb80f988fe7da1e31a 100644 |
--- a/third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc |
+++ b/third_party/protobuf/src/google/protobuf/arenastring.cc |
@@ -1,6 +1,6 @@ |
// Protocol Buffers - Google's data interchange format |
// Copyright 2008 Google Inc. All rights reserved. |
-// http://code.google.com/p/protobuf/ |
+// https://developers.google.com/protocol-buffers/ |
// |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
@@ -28,36 +28,43 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Author: qrczak@google.com (Marcin Kowalczyk) |
+// The ArenaString implementation is not included in the open-source release. Do |
+// not include this file in the distribution. |
-#include <google/protobuf/pyext/python_protobuf.h> |
+#include <google/protobuf/arenastring.h> |
namespace google { |
namespace protobuf { |
-namespace python { |
+namespace internal { |
-static const Message* GetCProtoInsidePyProtoStub(PyObject* msg) { |
- return NULL; |
+ |
+void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value, |
+ ArenaStringPtr value) { |
+ const ::std::string* me = *UnsafeRawStringPointer(); |
+ const ::std::string* other = *value.UnsafeRawStringPointer(); |
+ // If the pointers are the same then do nothing. |
+ if (me != other) { |
+ SetNoArena(default_value, value.GetNoArena(default_value)); |
+ } |
} |
-static Message* MutableCProtoInsidePyProtoStub(PyObject* msg) { |
- return NULL; |
+ |
+::std::string* ArenaStringPtr::MutableNoArena( |
+ const ::std::string* default_value) { |
+ if (ptr_ == default_value) { |
+ CreateInstanceNoArena(default_value); |
+ } |
+ return ptr_; |
} |
-// This is initialized with a default, stub implementation. |
-// If python-google.protobuf.cc is loaded, the function pointer is overridden |
-// with a full implementation. |
-const Message* (*GetCProtoInsidePyProtoPtr)(PyObject* msg) = |
- GetCProtoInsidePyProtoStub; |
-Message* (*MutableCProtoInsidePyProtoPtr)(PyObject* msg) = |
- MutableCProtoInsidePyProtoStub; |
-const Message* GetCProtoInsidePyProto(PyObject* msg) { |
- return GetCProtoInsidePyProtoPtr(msg); |
-} |
-Message* MutableCProtoInsidePyProto(PyObject* msg) { |
- return MutableCProtoInsidePyProtoPtr(msg); |
+void ArenaStringPtr::DestroyNoArena(const ::std::string* default_value) { |
+ if (ptr_ != default_value) { |
+ delete ptr_; |
+ } |
+ ptr_ = NULL; |
} |
-} // namespace python |
+ |
+} // namespace internal |
} // namespace protobuf |
} // namespace google |