aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/map.h
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2015-05-31 00:14:23 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2015-05-31 00:14:23 -0700
commit5a9be2c6f61201117f2d5b1106ee8e44dac972f5 (patch)
tree4d137dff593d7ceeac996832741e0e90497ca189 /src/google/protobuf/map.h
parent802e1848ada7d95e867b178314ee89629680c771 (diff)
Fix MapAllocator::destroy() bug.
destroy() should always call the destructor because the caller may rely on the destructor to do clean-ups.
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r--src/google/protobuf/map.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index c16fbed2..96d2f201 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -176,14 +176,12 @@ class Map {
template<class NodeType>
void destroy(NodeType* p) {
- if (arena_ == NULL) p->~NodeType();
+ p->~NodeType();
}
#else
void construct(pointer p, const_reference t) { new (p) value_type(t); }
- void destroy(pointer p) {
- if (arena_ == NULL) p->~value_type();
- }
+ void destroy(pointer p) { p->~value_type(); }
#endif
template <typename X>
@@ -201,10 +199,10 @@ class Map {
return arena_ != other.arena_;
}
- // To support Visual Studio 2008
- size_type max_size() const {
- return std::numeric_limits<size_type>::max();
- }
+ // To support Visual Studio 2008
+ size_type max_size() const {
+ return std::numeric_limits<size_type>::max();
+ }
private:
Arena* arena_;