aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-01-26 05:56:43 +0200
committerArnold D. Robbins <arnold@skeeve.com>2017-01-26 05:56:43 +0200
commit876a3380a5bae3a86aa0f1116e99f4fbea600a7a (patch)
treebdbf4d660a8fc547129f5625b85d119a86983960 /node.c
parentbb6f0828d2b8079d45585b3898d32c3c01f123bc (diff)
parent6b12d4f726b9578d5c878fa765d5c167c9d71618 (diff)
downloadegawk-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.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/node.c b/node.c
index 97f65fa3..f1f80177 100644
--- a/node.c
+++ b/node.c
@@ -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;