Author: brueffer
Date: Sat Feb 22 10:15:27 2014
New Revision: 262333
URL: http://svnweb.freebsd.org/changeset/base/262333

Log:
  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

Modified:
  head/usr.bin/hexdump/parse.c

Modified: head/usr.bin/hexdump/parse.c
==============================================================================
--- head/usr.bin/hexdump/parse.c        Sat Feb 22 09:53:17 2014        
(r262332)
+++ head/usr.bin/hexdump/parse.c        Sat Feb 22 10:15:27 2014        
(r262333)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to