From 85b69d8724ae79aad0a7bfb054f5ee93fd777549 Mon Sep 17 00:00:00 2001 From: Kevin Lo Date: Mon, 1 Dec 2014 02:59:05 +0000 Subject: [PATCH] MFC r275162: Init array field in the proper place. Obtained from: OpenBSD --- usr.bin/dc/stack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/dc/stack.c b/usr.bin/dc/stack.c index 950b4e5fdbf5..3364ae228c52 100644 --- a/usr.bin/dc/stack.c +++ b/usr.bin/dc/stack.c @@ -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