Changeset 1876 in kBuild for trunk/src/kmk
- Timestamp:
- Oct 17, 2008 1:02:35 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/misc.c
r1872 r1876 1200 1200 void *(*grow_alloc)(void *grow_arg, unsigned int size), void *grow_arg) 1201 1201 { 1202 /* ensure aligned and min sizeof (struct alloccache_free_ent). */ 1203 if (size & (sizeof (void *) - 1)) 1204 size += sizeof (void *) - (size & (sizeof (void *) - 1)); 1205 1202 unsigned act_size; 1203 1204 /* ensure OK alignment and min sizeof (struct alloccache_free_ent). */ 1205 if (size <= sizeof (struct alloccache_free_ent)) 1206 act_size = sizeof (struct alloccache_free_ent); 1207 else if (size <= 32) 1208 { 1209 act_size = 4; 1210 while (act_size < size) 1211 act_size <<= 1; 1212 } 1213 else 1214 act_size = (size + 31U) & ~(size_t)31; 1215 1216 /* align the structure. */ 1206 1217 cache->free_start = NULL; 1207 1218 cache->free_end = NULL; 1208 1219 cache->free_head = NULL; 1209 cache->size = size;1220 cache->size = act_size; 1210 1221 cache->alloc_count = 0; 1211 1222 cache->total_count = 0; … … 1214 1225 cache->grow_alloc = grow_alloc ? grow_alloc : alloccache_default_grow_alloc; 1215 1226 1227 /* link it. */ 1216 1228 cache->next = alloccache_head; 1217 1229 alloccache_head = cache; … … 1223 1235 void (*term_free)(void *term_arg, void *ptr, unsigned int size), void *term_arg) 1224 1236 { 1225 cache->size = 0; 1237 /*cache->size = 0;*/ 1238 (void)cache; 1226 1239 (void)term_free; 1227 1240 (void)term_arg;
Note:
See TracChangeset
for help on using the changeset viewer.