diff options
author | Bo Yang <teboring@google.com> | 2016-09-19 13:45:07 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2016-10-10 11:23:36 -0700 |
commit | cc8ca5b6a5478b40546d4206392eb1471454460d (patch) | |
tree | c0b45abfa16d7d373a6ea8f7fe50f1de00ab938e /src/google/protobuf/map.h | |
parent | 337a028bb65ccca4dda768695950b5aba53ae2c9 (diff) |
Integrate internal changes
Diffstat (limited to 'src/google/protobuf/map.h')
-rw-r--r-- | src/google/protobuf/map.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index bfc63b0f..2d295510 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -565,7 +565,7 @@ class Map { void Init() { if (old_style_) deprecated_elements_ = Arena::Create<DeprecatedInnerMap>( - arena_, 0, hasher(), equal_to<Key>(), + arena_, 0, hasher(), std::equal_to<Key>(), MapAllocator<std::pair<const Key, MapPair<Key, T>*> >(arena_)); else elements_ = @@ -596,7 +596,7 @@ class Map { // If arena is not given, malloc needs to be called which doesn't // construct element object. if (arena_ == NULL) { - return reinterpret_cast<pointer>(malloc(n * sizeof(value_type))); + return static_cast<pointer>(::operator new(n * sizeof(value_type))); } else { return reinterpret_cast<pointer>( Arena::CreateArray<uint8>(arena_, n * sizeof(value_type))); @@ -605,7 +605,11 @@ class Map { void deallocate(pointer p, size_type n) { if (arena_ == NULL) { - free(p); +#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) + ::operator delete(p, n * sizeof(value_type)); +#else + ::operator delete(p); +#endif } } @@ -1351,7 +1355,7 @@ class Map { GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(InnerMap); }; // end of class InnerMap - typedef hash_map<Key, value_type*, hash<Key>, equal_to<Key>, + typedef hash_map<Key, value_type*, hash<Key>, std::equal_to<Key>, MapAllocator<std::pair<const Key, MapPair<Key, T>*> > > DeprecatedInnerMap; |