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
This commit is contained in:
Christian Brueffer 2014-02-22 10:15:27 +00:00
parent c4f5dc40a0
commit 8c91e67c8c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262333

View file

@ -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);