Prevented NO-OP calls to the memory allocator

Also shaved off about 1-2 milliseconds of execution time of fib-memo.toy
This commit is contained in:
2023-02-26 21:20:22 +11:00
parent 1064b69d04
commit 624a0c80ba
7 changed files with 44 additions and 25 deletions

View File

@@ -8,10 +8,10 @@
//default allocator
void* Toy_private_defaultMemoryAllocator(void* pointer, size_t oldSize, size_t newSize) {
if (newSize == 0 && oldSize == 0) {
//causes issues, so just skip out with a NO-OP
return NULL;
}
//causes issues, so just skip out with a NO-OP (DISABLED for performance reasons)
// if (newSize == 0 && oldSize == 0) {
// return NULL;
// }
if (newSize == 0) {
free(pointer);