Branch Coverage

src/b_stack.c
Criterion Covered Total %
branch 23 46 50.0


line true false branch
8 0 39771 size_t growth_factor = grow_by > 0? grow_by: B_STACK_DEFAULT_GROWTH_FACTOR;
10 0 39771 if ((stack = malloc(sizeof(*stack))) == NULL) {
14 0 39771 if ((stack->items = calloc(growth_factor, sizeof(void *))) == NULL) {
39 0 0 if (newsize == 0) {
43 0 0 if ((newitems = realloc(stack->items, newsize * sizeof(void *))) == NULL) {
59 0 43079 if (stack->count == stack->size) {
60 0 0 if (b_stack_resize(stack, stack->size + stack->growth_factor) == NULL) {
80 0 13545 if (stack == NULL) return NULL;
81 6670 6875 if (stack->count == 0) return NULL;
89 0 6875 if (index == stack->size - (stack->growth_factor * 2)) {
90 0 0 if (b_stack_resize(stack, stack->size - stack->growth_factor) == NULL) {
105 0 14 if (stack == NULL) return NULL;
106 0 14 if (stack->count == 0) return NULL;
111 42 14 for (i=1; icount; i++) {
118 0 14 if (last == stack->size - (stack->growth_factor * 2)) {
119 0 0 if (b_stack_resize(stack, stack->size - stack->growth_factor) == NULL) {
131 0 417 if (stack == NULL) return NULL;
132 31 386 if (stack->count == 0) return NULL;
138 0 79050 if (index >= stack->count) return NULL;
151 97 13340 for (i=0; i
165 0 33223 if (stack == NULL) return;
167 33223 0 if (stack->destructor) {
168 36190 33223 for (i=0; icount; i++) {