| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 namespace protobuf { | 37 namespace protobuf { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 | 40 |
| 41 void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value, | 41 void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value, |
| 42 ArenaStringPtr value) { | 42 ArenaStringPtr value) { |
| 43 const ::std::string* me = *UnsafeRawStringPointer(); | 43 const ::std::string* me = *UnsafeRawStringPointer(); |
| 44 const ::std::string* other = *value.UnsafeRawStringPointer(); | 44 const ::std::string* other = *value.UnsafeRawStringPointer(); |
| 45 // If the pointers are the same then do nothing. | 45 // If the pointers are the same then do nothing. |
| 46 if (me != other) { | 46 if (me != other) { |
| 47 SetNoArena(default_value, value.GetNoArena(default_value)); | 47 SetNoArena(default_value, value.GetNoArena()); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 ::std::string* ArenaStringPtr::MutableNoArena( | 51 ::std::string* ArenaStringPtr::MutableNoArena( |
| 52 const ::std::string* default_value) { | 52 const ::std::string* default_value) { |
| 53 if (ptr_ == default_value) { | 53 if (ptr_ == default_value) { |
| 54 CreateInstanceNoArena(default_value); | 54 CreateInstanceNoArena(default_value); |
| 55 } | 55 } |
| 56 return ptr_; | 56 return ptr_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 void ArenaStringPtr::DestroyNoArena(const ::std::string* default_value) { | 60 void ArenaStringPtr::DestroyNoArena(const ::std::string* default_value) { |
| 61 if (ptr_ != default_value) { | 61 if (ptr_ != default_value) { |
| 62 delete ptr_; | 62 delete ptr_; |
| 63 } | 63 } |
| 64 ptr_ = NULL; | 64 ptr_ = NULL; |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 } // namespace internal | 68 } // namespace internal |
| 69 } // namespace protobuf | 69 } // namespace protobuf |
| 70 } // namespace google | 70 } // namespace google |
| OLD | NEW |