diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2017-01-26 05:56:43 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2017-01-26 05:56:43 +0200 |
commit | 876a3380a5bae3a86aa0f1116e99f4fbea600a7a (patch) | |
tree | bdbf4d660a8fc547129f5625b85d119a86983960 /node.c | |
parent | bb6f0828d2b8079d45585b3898d32c3c01f123bc (diff) | |
parent | 6b12d4f726b9578d5c878fa765d5c167c9d71618 (diff) | |
download | egawk-876a3380a5bae3a86aa0f1116e99f4fbea600a7a.tar.gz egawk-876a3380a5bae3a86aa0f1116e99f4fbea600a7a.tar.bz2 egawk-876a3380a5bae3a86aa0f1116e99f4fbea600a7a.zip |
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1001,32 +1001,33 @@ void init_btowc_cache() #define BLOCKCHUNK 100 -BLOCK nextfree[BLOCK_MAX] = { - { 0, NULL}, /* invalid */ - { sizeof(NODE), NULL }, - { sizeof(BUCKET), NULL }, +struct block_header nextfree[BLOCK_MAX] = { + { NULL, 0}, /* invalid */ + { NULL, sizeof(NODE) }, + { NULL, sizeof(BUCKET) }, }; /* more_blocks --- get more blocks of memory and add to the free list; - size of a block must be >= sizeof(BLOCK) + size of a block must be >= sizeof(struct block_item) */ void * more_blocks(int id) { - BLOCK *freep, *np, *next; + struct block_item *freep, *np, *next; char *p, *endp; size_t size; size = nextfree[id].size; - emalloc(freep, BLOCK *, BLOCKCHUNK * size, "more_blocks"); + assert(size >= sizeof(struct block_item)); + emalloc(freep, struct block_item *, BLOCKCHUNK * size, "more_blocks"); p = (char *) freep; endp = p + BLOCKCHUNK * size; for (np = freep; ; np = next) { - next = (BLOCK *) (p += size); + next = (struct block_item *) (p += size); if (p >= endp) { np->freep = NULL; break; |