Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Mar 2014 12:26:17 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r262928 - stable/8/usr.bin/hexdump
Message-ID:  <201403081226.s28CQHR3026229@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Sat Mar  8 12:26:17 2014
New Revision: 262928
URL: http://svnweb.freebsd.org/changeset/base/262928

Log:
  MFC: r262333
  
  Simplify the way the end of a singly linked list is followed (for adding
  items), so it is more obvious that we aren't going to indirect through
  a NULL pointer.
  
  PR:             144723
  Submitted by:   Garrett Cooper <yaneurabeya at gmail.com>
  Obtained from:  NetBSD r1.19

Modified:
  stable/8/usr.bin/hexdump/parse.c
Directory Properties:
  stable/8/usr.bin/hexdump/   (props changed)

Modified: stable/8/usr.bin/hexdump/parse.c
==============================================================================
--- stable/8/usr.bin/hexdump/parse.c	Sat Mar  8 12:25:45 2014	(r262927)
+++ stable/8/usr.bin/hexdump/parse.c	Sat Mar  8 12:26:17 2014	(r262928)
@@ -214,7 +214,6 @@ rewrite(FS *fs)
 	int nconv, prec;
 	size_t len;
 
-	nextpr = NULL;
 	prec = 0;
 
 	for (fu = fs->nextfu; fu; fu = fu->nextfu) {
@@ -222,13 +221,11 @@ rewrite(FS *fs)
 		 * Break each format unit into print units; each conversion
 		 * character gets its own.
 		 */
+		nextpr = &fu->nextpr;
 		for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
 			if ((pr = calloc(1, sizeof(PR))) == NULL)
 				err(1, NULL);
-			if (!fu->nextpr)
-				fu->nextpr = pr;
-			else
-				*nextpr = pr;
+			*nextpr = pr;
 
 			/* Skip preceding text and up to the next % sign. */
 			for (p1 = fmtp; *p1 && *p1 != '%'; ++p1);



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