diff options
author | brueffer <brueffer@FreeBSD.org> | 2014-02-22 10:15:27 +0000 |
---|---|---|
committer | brueffer <brueffer@FreeBSD.org> | 2014-02-22 10:15:27 +0000 |
commit | c917c5fba9d9696174f2d0bb435634cd8f040a3c (patch) | |
tree | 78f0dbad7b23c4917ec96bf0f7153dda4ddb71fe /usr.bin/hexdump | |
parent | f59f2958fb1a67b08698c9fac8cbac31d73c0911 (diff) | |
download | FreeBSD-src-c917c5fba9d9696174f2d0bb435634cd8f040a3c.zip FreeBSD-src-c917c5fba9d9696174f2d0bb435634cd8f040a3c.tar.gz |
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
MFC after: 2 weeks
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r-- | usr.bin/hexdump/parse.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index b10ce01..10db904 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); |