MFC r275162:

Init array field in the proper place.

Obtained from:	OpenBSD
This commit is contained in:
Kevin Lo 2014-12-01 02:59:05 +00:00
parent c0b1cd2964
commit 85b69d8724
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=275348

View File

@ -137,14 +137,12 @@ stack_swap(struct stack *stack)
static void
stack_grow(struct stack *stack)
{
size_t i, new_size;
size_t new_size;
if (++stack->sp == stack->size) {
new_size = stack->size * 2 + 1;
stack->stack = brealloc(stack->stack,
new_size * sizeof(*stack->stack));
for (i = stack->size; i < new_size; i++)
stack->stack[i].array = NULL;
stack->size = new_size;
}
}
@ -156,6 +154,7 @@ stack_pushnumber(struct stack *stack, struct number *b)
stack_grow(stack);
stack->stack[stack->sp].type = BCODE_NUMBER;
stack->stack[stack->sp].u.num = b;
stack->stack[stack->sp].array = NULL;
}
void
@ -165,6 +164,7 @@ stack_pushstring(struct stack *stack, char *string)
stack_grow(stack);
stack->stack[stack->sp].type = BCODE_STRING;
stack->stack[stack->sp].u.string = string;
stack->stack[stack->sp].array = NULL;
}
void