Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Nov 2014 01:37:01 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r275162 - head/usr.bin/dc
Message-ID:  <201411270137.sAR1b1EC096891@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Thu Nov 27 01:37:01 2014
New Revision: 275162
URL: https://svnweb.freebsd.org/changeset/base/275162

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

Modified:
  head/usr.bin/dc/stack.c

Modified: head/usr.bin/dc/stack.c
==============================================================================
--- head/usr.bin/dc/stack.c	Thu Nov 27 00:39:01 2014	(r275161)
+++ head/usr.bin/dc/stack.c	Thu Nov 27 01:37:01 2014	(r275162)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411270137.sAR1b1EC096891>