mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-03-10 03:29:59 +01:00
Merge branch 'master' into json-pointer
This commit is contained in:
commit
86d298cd46
@ -189,6 +189,9 @@ public:
|
||||
if (originalPtr == 0)
|
||||
return Malloc(newSize);
|
||||
|
||||
if (newSize == 0)
|
||||
return NULL;
|
||||
|
||||
// Do not shrink if new size is smaller than original
|
||||
if (originalSize >= newSize)
|
||||
return originalPtr;
|
||||
|
@ -42,6 +42,9 @@ void TestAllocator(Allocator& a) {
|
||||
EXPECT_EQ(i, r[i]);
|
||||
|
||||
Allocator::Free(r);
|
||||
|
||||
// Realloc to zero size
|
||||
EXPECT_TRUE(a.Realloc(a.Malloc(1), 1, 0) == 0);
|
||||
}
|
||||
|
||||
TEST(Allocator, CrtAllocator) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user