Changeset 1535 in kBuild for trunk/src/kmk/misc.c
- Timestamp:
- Apr 20, 2008 10:19:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/misc.c
r1469 r1535 363 363 #ifdef CONFIG_WITH_MAKE_STATS 364 364 make_stats_allocations++; 365 make_stats_allocated += SIZE_OF_HEAP_BLOCK (result); 366 make_stats_allocated_sum += SIZE_OF_HEAP_BLOCK (result); 365 if (make_expensive_statistics) 366 { 367 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result); 368 make_stats_allocated += actual_size; 369 make_stats_allocated_sum += actual_size; 370 } 367 371 #endif 368 372 return result; … … 375 379 void *result; 376 380 #ifdef CONFIG_WITH_MAKE_STATS 377 if (ptr != NULL) 378 { 379 make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr); 380 make_stats_allocated_sum -= SIZE_OF_HEAP_BLOCK (ptr); 381 if (make_expensive_statistics && ptr != NULL) 382 { 383 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (ptr); 384 make_stats_allocated -= actual_size; 385 make_stats_allocated_sum -= actual_size; 381 386 } 382 387 #endif … … 389 394 fatal (NILF, _("virtual memory exhausted")); 390 395 #ifdef CONFIG_WITH_MAKE_STATS 391 make_stats_allocated += SIZE_OF_HEAP_BLOCK (result); 392 make_stats_allocated_sum += SIZE_OF_HEAP_BLOCK (result); 396 if (!ptr) 397 make_stats_allocations++; 398 if (make_expensive_statistics) 399 { 400 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result); 401 make_stats_allocated += actual_size; 402 make_stats_allocated_sum += actual_size; 403 } 393 404 #endif 394 405 return result; … … 412 423 #ifdef CONFIG_WITH_MAKE_STATS 413 424 make_stats_allocations++; 414 make_stats_allocated += SIZE_OF_HEAP_BLOCK (result); 415 make_stats_allocated_sum += SIZE_OF_HEAP_BLOCK (result); 425 if (make_expensive_statistics) 426 { 427 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result); 428 make_stats_allocated += actual_size; 429 make_stats_allocated_sum += actual_size; 430 } 416 431 #endif 417 432 #ifdef HAVE_STRDUP … … 950 965 void xfree(void *ptr) 951 966 { 952 if (ptr) 967 if (ptr) 953 968 { 954 969 make_stats_allocations--; 955 make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr); 970 if (make_expensive_statistics) 971 make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr); 956 972 free (ptr); 957 973 }
Note:
See TracChangeset
for help on using the changeset viewer.