diff --git a/lib/xma.c b/lib/xma.c index 1b2c1936..c75ab4e1 100644 --- a/lib/xma.c +++ b/lib/xma.c @@ -653,7 +653,7 @@ void* hawk_xma_realloc (hawk_xma_t* xma, void* b, hawk_oow_t size) { void* n; - if (b == HAWK_NULL) + if (!b) { /* 'realloc' with NULL is the same as 'alloc' */ n = hawk_xma_alloc(xma, size); @@ -661,9 +661,9 @@ void* hawk_xma_realloc (hawk_xma_t* xma, void* b, hawk_oow_t size) else { /* try reallocation by merging the adjacent continuous blocks */ - #if defined(HAWK_XMA_ENABLE_STAT) - xma->stat.nreallocops++; - #endif + #if defined(HAWK_XMA_ENABLE_STAT) + xma->stat.nreallocops++; + #endif n = _realloc_merge(xma, b, size); if (!n) { diff --git a/t/t-009.c b/t/t-009.c index 25d11af4..d0ff5724 100644 --- a/t/t-009.c +++ b/t/t-009.c @@ -44,7 +44,7 @@ int main() double malloc_time = 0.0, free_time = 0.0; no_plan(); - hawk_init_xma_mmgr(&xma_mmgr, NUM_OPERATIONS * MAX_ALLOC_SIZE); + hawk_init_xma_mmgr(&xma_mmgr, 20000000); srand((unsigned int)time(NULL)); start_time = clock();