svn commit: r275349 - stable/9/usr.bin/dc

Kevin Lo kevlo at FreeBSD.org
Mon Dec 1 03:01:03 UTC 2014


Author: kevlo
Date: Mon Dec  1 03:01:01 2014
New Revision: 275349
URL: https://svnweb.freebsd.org/changeset/base/275349

Log:
  MFC r275162:
  Init array field in the proper place.
  
  Obtained from:	OpenBSD

Modified:
  stable/9/usr.bin/dc/stack.c   (contents, props changed)

Modified: stable/9/usr.bin/dc/stack.c
==============================================================================
--- stable/9/usr.bin/dc/stack.c	Mon Dec  1 02:59:05 2014	(r275348)
+++ stable/9/usr.bin/dc/stack.c	Mon Dec  1 03:01:01 2014	(r275349)
@@ -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, st
 	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, ch
 	stack_grow(stack);
 	stack->stack[stack->sp].type = BCODE_STRING;
 	stack->stack[stack->sp].u.string = string;
+	stack->stack[stack->sp].array = NULL;
 }
 
 void


More information about the svn-src-stable-9 mailing list