summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorkevlo <kevlo@FreeBSD.org>2014-12-01 02:59:05 +0000
committerkevlo <kevlo@FreeBSD.org>2014-12-01 02:59:05 +0000
commita97617028aef0adbf0f98680284321d0157f5291 (patch)
tree031fa3482bd343cb5a71fa931c31bfa8a199e0a4 /usr.bin
parenteafe9cc2c3e7b8d113a4e5546a2f1278b98b9860 (diff)
downloadFreeBSD-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')
-rw-r--r--usr.bin/dc/stack.c6
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
OpenPOWER on IntegriCloud