diff --git a/processor/main.m4 b/processor/main.m4 index b064286..ecb29e2 100644 --- a/processor/main.m4 +++ b/processor/main.m4 @@ -38,7 +38,7 @@ define(`ALLOC', ` ') IFSTORE(` IFASSERT(`{ - if (!xc_stack_size(&processor->allocsizes)) { + if (!xc_stack_count(&processor->allocsizes)) { fprintf(stderr, "mismatch `$@' at line %d\n", __LINE__); } else { diff --git a/stack.c b/stack.c index ac36661..451ea4f 100644 --- a/stack.c +++ b/stack.c @@ -3,10 +3,10 @@ #include "stack.h" typedef xc_stack_t* S; -void xc_stack_init(S stack) +void xc_stack_init_ex(S stack, int initsize) { stack->cnt = 0; - stack->size = 8; + stack->size = initsize; stack->data = malloc(sizeof(void *) * stack->size); } @@ -42,7 +42,7 @@ void* xc_stack_get(S stack, int n) return stack->data[n]; } -int xc_stack_size(S stack) +int xc_stack_count(S stack) { assert(stack != NULL); return stack->cnt; diff --git a/stack.h b/stack.h index 248472d..6821674 100644 --- a/stack.h +++ b/stack.h @@ -6,12 +6,13 @@ typedef struct { } xc_stack_t; #define S xc_stack_t* -void xc_stack_init(S stack); +void xc_stack_init_ex(S stack, int initsize); +#define xc_stack_init(stack) xc_stack_init_ex(stack, 8) void xc_stack_destroy(S stack); void xc_stack_push(S stack, void *item); void *xc_stack_pop(S stack); void *xc_stack_top(S stack); void *xc_stack_get(S stack, int n); -int xc_stack_size(S stack); +int xc_stack_count(S stack); void xc_stack_reverse(S stack); #undef S diff --git a/xcache.c b/xcache.c index 635ad6c..fee027f 100644 --- a/xcache.c +++ b/xcache.c @@ -605,11 +605,11 @@ static inline void xc_entry_unholds_real(xc_stack_t *holds, xc_cache_t **caches, for (i = 0; i < cachecount; i ++) { s = &holds[i]; - TRACE("holded %d", xc_stack_size(s)); - if (xc_stack_size(s)) { + TRACE("holded %d", xc_stack_count(s)); + if (xc_stack_count(s)) { cache = ((xc_entry_t *)xc_stack_top(s))->cache; ENTER_LOCK(cache) { - while (xc_stack_size(s)) { + while (xc_stack_count(s)) { xce = (xc_entry_t*) xc_stack_pop(s); TRACE("unhold %s", xce->name.str.val); xce->refcount --;