From 8c91e67c8c2b665924011218feaff82054265c5f Mon Sep 17 00:00:00 2001 From: Christian Brueffer Date: Sat, 22 Feb 2014 10:15:27 +0000 Subject: [PATCH] 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 Obtained from: NetBSD r1.19 MFC after: 2 weeks --- usr.bin/hexdump/parse.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index b10ce01948ba..10db904dc0e6 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -210,7 +210,6 @@ rewrite(FS *fs) int nconv, prec; size_t len; - nextpr = NULL; prec = 0; for (fu = fs->nextfu; fu; fu = fu->nextfu) { @@ -218,13 +217,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);