Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Mar 2017 03:50:13 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315104 - head/lib/libc/stdio
Message-ID:  <201703120350.v2C3oDwP025207@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Mar 12 03:50:13 2017
New Revision: 315104
URL: https://svnweb.freebsd.org/changeset/base/315104

Log:
  libc: small cleanup.
  
  Initialize newsize in the code section so we avoids asigning the
  value if we exit early.

Modified:
  head/lib/libc/stdio/printf-pos.c

Modified: head/lib/libc/stdio/printf-pos.c
==============================================================================
--- head/lib/libc/stdio/printf-pos.c	Sun Mar 12 03:49:05 2017	(r315103)
+++ head/lib/libc/stdio/printf-pos.c	Sun Mar 12 03:50:13 2017	(r315104)
@@ -641,12 +641,13 @@ __grow_type_table(struct typetable *type
 	enum typeid *const oldtable = types->table;
 	const int oldsize = types->tablesize;
 	enum typeid *newtable;
-	u_int n, newsize = oldsize * 2;
+	u_int n, newsize;
 
 	/* Detect overflow */
 	if (types->nextarg > NL_ARGMAX)
 		return (-1);
 
+	newsize = oldsize * 2;
 	if (newsize < types->nextarg + 1)
 		newsize = types->nextarg + 1;
 	if (oldsize == STATIC_ARG_TBL_SIZE) {



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