Skip to content

Commit

Permalink
Simplify the way the end of a singly linked list is followed (for adding
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cbrueffer committed Feb 22, 2014
1 parent c4f5dc4 commit 8c91e67
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions usr.bin/hexdump/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,18 @@ rewrite(FS *fs)
int nconv, prec;
size_t len;

nextpr = NULL;
prec = 0;

for (fu = fs->nextfu; fu; fu = fu->nextfu) {
/*
* 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);
Expand Down

0 comments on commit 8c91e67

Please sign in to comment.