Centralized assertion macros and made them obey JSON_USE_EXCEPTION.

This commit is contained in:
Aaron Jacobs
2011-05-24 01:03:22 +00:00
parent a77a803c85
commit e3d0eca9f4
4 changed files with 28 additions and 9 deletions

View File

@@ -53,8 +53,7 @@ public: // overridden from ValueArrayAllocator
if ( minNewIndexCount > newIndexCount )
newIndexCount = minNewIndexCount;
void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
if ( !newIndexes )
throw std::bad_alloc();
JSON_ASSERT_MESSAGE(newIndexes, "Couldn't realloc.");
indexCount = newIndexCount;
indexes = static_cast<Value **>( newIndexes );
}
@@ -117,8 +116,7 @@ public: // overridden from ValueArrayAllocator
if ( minNewIndexCount > newIndexCount )
newIndexCount = minNewIndexCount;
void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
if ( !newIndexes )
throw std::bad_alloc();
JSON_ASSERT_MESSAGE(newIndexes, "Couldn't realloc.");
indexCount = newIndexCount;
indexes = static_cast<Value **>( newIndexes );
}