Changeset 2633 in kBuild
- Timestamp:
- Sep 8, 2012 11:18:59 PM (12 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/alloccache.c
r2413 r2633 54 54 alloccache_free (struct alloccache *cache, void *item) 55 55 { 56 #ifndef CONFIG_WITH_ALLOCCACHE_DEBUG 56 57 struct alloccache_free_ent *f = (struct alloccache_free_ent *)item; 57 # if 0 /*ndef NDEBUG*/58 # if 0 /*ndef NDEBUG*/ 58 59 struct alloccache_free_ent *c; 59 60 unsigned int i = 0; … … 61 62 MY_ASSERT_MSG (c != f && i < 0x10000000, 62 63 ("i=%u total_count=%u\n", i, cache->total_count)); 63 # endif64 # endif 64 65 65 66 f->next = cache->free_head; 66 67 cache->free_head = f; 67 68 MAKE_STATS(cache->free_count++;); 69 #else 70 free(item); 71 #endif 68 72 } 69 73 … … 79 83 alloccache_alloc_grow (struct alloccache *cache) 80 84 { 85 #ifndef CONFIG_WITH_ALLOCCACHE_DEBUG 81 86 void *item; 82 87 unsigned int items = (64*1024 - 32) / cache->size; … … 85 90 cache->total_count+= items; 86 91 87 # ifndef NDEBUG /* skip the first item so the heap can detect free(). */92 # ifndef NDEBUG /* skip the first item so the heap can detect free(). */ 88 93 cache->total_count--; 89 94 cache->free_start += cache->size; 90 # endif95 # endif 91 96 92 97 item = cache->free_start; … … 94 99 /* caller counts */ 95 100 return (struct alloccache_free_ent *)item; 101 #else 102 return (struct alloccache_free_ent *)xmalloc(cache->size); 103 #endif 96 104 } 97 105 -
trunk/src/kmk/make.h
r2591 r2633 639 639 alloccache_alloc (struct alloccache *cache) 640 640 { 641 struct alloccache_free_ent *f = cache->free_head; 641 struct alloccache_free_ent *f; 642 # ifndef CONFIG_WITH_ALLOCCACHE_DEBUG 643 f = cache->free_head; 642 644 if (f) 643 645 cache->free_head = f->next; … … 648 650 } 649 651 else 652 # endif 650 653 f = alloccache_alloc_grow (cache); 651 654 MAKE_STATS(cache->alloc_count++;);
Note:
See TracChangeset
for help on using the changeset viewer.