diff options
author | kevlo <kevlo@FreeBSD.org> | 2014-12-01 02:59:05 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2014-12-01 02:59:05 +0000 |
commit | a97617028aef0adbf0f98680284321d0157f5291 (patch) | |
tree | 031fa3482bd343cb5a71fa931c31bfa8a199e0a4 /usr.bin/dc | |
parent | eafe9cc2c3e7b8d113a4e5546a2f1278b98b9860 (diff) | |
download | FreeBSD-src-a97617028aef0adbf0f98680284321d0157f5291.zip FreeBSD-src-a97617028aef0adbf0f98680284321d0157f5291.tar.gz |
MFC r275162:
Init array field in the proper place.
Obtained from: OpenBSD
Diffstat (limited to 'usr.bin/dc')
-rw-r--r-- | usr.bin/dc/stack.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/dc/stack.c b/usr.bin/dc/stack.c index 950b4e5..3364ae2 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 |