Changeset 1899 in kBuild
- Timestamp:
- Oct 21, 2008 1:51:48 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/strcache2.c
r1897 r1899 74 74 struct strcache2_seg *seg; 75 75 size_t size; 76 size_t off; 76 77 77 78 size = cache->def_seg_size; 78 if (size < (size_t)minlen + sizeof (struct strcache2_seg) )79 if (size < (size_t)minlen + sizeof (struct strcache2_seg) + STRCACHE2_ENTRY_ALIGNMENT) 79 80 { 80 81 size = (size_t)minlen * 2; … … 83 84 84 85 seg = xmalloc (size); 85 seg->cursor = seg->start = (char *)(seg + 1); 86 seg->size = seg->avail = size - sizeof (struct strcache2_seg); 86 seg->start = (char *)(seg + 1); 87 seg->size = size - sizeof (struct strcache2_seg); 88 off = (size_t)seg->start & (STRCACHE2_ENTRY_ALIGNMENT - 1); 89 if (off) 90 { 91 seg->start += off; 92 seg->size -= off; 93 } 87 94 assert (seg->size > minlen); 95 seg->cursor = seg->start; 96 seg->avail = seg->size; 88 97 89 98 seg->next = cache->seg_head; … … 539 548 540 549 entry = (struct strcache2_entry *) seg->cursor; 550 assert ((size_t)entry & (STRCACHE2_ENTRY_ALIGNMENT - 1)); 541 551 seg->cursor += size; 542 552 seg->avail -= size;
Note:
See TracChangeset
for help on using the changeset viewer.