diff options
author | brueffer <brueffer@FreeBSD.org> | 2014-03-08 12:24:47 +0000 |
---|---|---|
committer | brueffer <brueffer@FreeBSD.org> | 2014-03-08 12:24:47 +0000 |
commit | b3a8c13b8345cc49ab30c2562f746cec4bb77514 (patch) | |
tree | 8621d98b6d0e696e6af55bb0a8c9dd9022a6effe /usr.bin/hexdump | |
parent | 9ccdbaa5351837ba0667f036a3c06777e6d79393 (diff) | |
download | FreeBSD-src-b3a8c13b8345cc49ab30c2562f746cec4bb77514.zip FreeBSD-src-b3a8c13b8345cc49ab30c2562f746cec4bb77514.tar.gz |
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
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); |