From owner-svn-src-all@FreeBSD.ORG Thu Nov 27 01:37:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B6AE9932; Thu, 27 Nov 2014 01:37:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3E12126; Thu, 27 Nov 2014 01:37:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAR1b1rc096892; Thu, 27 Nov 2014 01:37:01 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAR1b1EC096891; Thu, 27 Nov 2014 01:37:01 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201411270137.sAR1b1EC096891@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Thu, 27 Nov 2014 01:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275162 - head/usr.bin/dc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 01:37:01 -0000 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