Ping.
On Wed, Jun 04, 2014 at 10:01:12AM -0500, Kent R. Spillner wrote:
> config(char *) contains a hand-rolled version of getlist(char *). The only
> difference
> is that the hand-rolled version includes a NULL check before the strcmp.
> Replace this
> with a call to getlist(char *) instead, and move the NULL check there to
> protect other
> callers as well.
>
> I think we can probably drop the NULL check altogether because we already
> check p is not
> NULL as the loop condition in the for-loop. However, since the original code
> had an
> explicit check I decided to preserve it. I'm ok dropping the second hunk of
> this diff
> if others agree it's unnecessary.
>
>
> Index: usr.bin/man/config.c
> ===================================================================
> RCS file: /work/cvsroot/src/usr.bin/man/config.c,v
> retrieving revision 1.9
> diff -p -u -r1.9 config.c
> --- usr.bin/man/config.c 27 Oct 2009 23:59:40 -0000 1.9
> +++ usr.bin/man/config.c 4 Jun 2014 14:51:10 -0000
> @@ -92,8 +92,7 @@ config(char *fname)
> continue;
> *t = '\0';
>
> - for (tp = TAILQ_FIRST(&head); /* Find any matching tag. */
> - tp != NULL && strcmp(p, tp->s); tp = TAILQ_NEXT(tp, q));
> + tp = getlist(p); /* Find any matching tag. */
>
> if (tp == NULL) /* Create a new tag. */
> tp = addlist(p);
> @@ -147,6 +146,9 @@ TAG *
> getlist(char *name)
> {
> TAG *tp;
> +
> + if (name == NULL)
> + return (NULL);
>
> TAILQ_FOREACH(tp, &head, q)
> if (!strcmp(name, tp->s))
>