Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/nvi/dist/ex use more list macros



details:   https://anonhg.NetBSD.org/src/rev/04f007ac788d
branches:  trunk
changeset: 791682:04f007ac788d
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 28 03:15:02 2013 +0000

description:
use more list macros

diffstat:

 external/bsd/nvi/dist/ex/ex_tag.c |  24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diffs (75 lines):

diff -r 8def19157133 -r 04f007ac788d external/bsd/nvi/dist/ex/ex_tag.c
--- a/external/bsd/nvi/dist/ex/ex_tag.c Thu Nov 28 03:14:28 2013 +0000
+++ b/external/bsd/nvi/dist/ex/ex_tag.c Thu Nov 28 03:15:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ex_tag.c,v 1.6 2013/11/27 20:45:33 christos Exp $ */
+/*     $NetBSD: ex_tag.c,v 1.7 2013/11/28 03:15:02 christos Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
@@ -541,8 +541,7 @@
         */
        for (cnt = 1, tqp = TAILQ_FIRST(&exp->tq); !INTERRUPTED(sp) &&
            tqp != NULL; ++cnt, tqp = TAILQ_NEXT(tqp, q))
-               for (tp = TAILQ_FIRST(&tqp->tagq);
-                   tp != NULL; tp = TAILQ_NEXT(tp, q)) {
+               TAILQ_FOREACH(tp, &tqp->tagq, q) {
                        if (tp == TAILQ_FIRST(&tqp->tagq))
                                (void)ex_printf(sp, "%2d ", cnt);
                        else
@@ -590,12 +589,10 @@
        nexp = EXP(sp);
 
        /* Copy tag queue and tags stack. */
-       for (aqp = TAILQ_FIRST(&oexp->tq);
-           aqp != NULL; aqp = TAILQ_NEXT(aqp, q)) {
+       TAILQ_FOREACH(aqp, &oexp->tq, q) {
                if (tagq_copy(sp, aqp, &tqp))
                        return (1);
-               for (ap = TAILQ_FIRST(&aqp->tagq);
-                   ap != NULL; ap = TAILQ_NEXT(ap, q)) {
+               TAILQ_FOREACH(ap, &aqp->tagq, q) {
                        if (tag_copy(sp, ap, &tp))
                                return (1);
                        /* Set the current pointer. */
@@ -607,8 +604,8 @@
        }
 
        /* Copy list of tag files. */
-       for (atfp = oexp->tagfq.tqh_first;
-           atfp != NULL; atfp = atfp->q.tqe_next) {
+
+       TAILQ_FOREACH(atfp, &oexp->tagfq, q) {
                if (tagf_copy(sp, atfp, &tfp))
                        return (1);
                TAILQ_INSERT_TAIL(&nexp->tagfq, tfp, q);
@@ -895,7 +892,7 @@
 
        /* Free current queue. */
        exp = EXP(sp);
-       while ((tfp = exp->tagfq.tqh_first) != NULL)
+       while ((tfp = TAILQ_FIRST(&exp->tagfq)) != NULL)
                tagf_free(sp, tfp);
 
        /* Create new queue. */
@@ -1162,8 +1159,8 @@
         * Find the tag, only display missing file messages once, and
         * then only if we didn't find the tag.
         */
-       for (echk = 0,
-           tfp = exp->tagfq.tqh_first; tfp != NULL; tfp = tfp->q.tqe_next)
+       echk = 0;
+       TAILQ_FOREACH(tfp, &exp->tagfq, q)
                if (ctag_sfile(sp, tfp, tqp, tqp->tag)) {
                        echk = 1;
                        F_SET(tfp, TAGF_ERR);
@@ -1174,8 +1171,7 @@
        if (TAILQ_EMPTY(&tqp->tagq)) {
                msgq_str(sp, M_ERR, tqp->tag, "162|%s: tag not found");
                if (echk)
-                       for (tfp = exp->tagfq.tqh_first;
-                           tfp != NULL; tfp = tfp->q.tqe_next)
+                       TAILQ_FOREACH(tfp, &exp->tagfq, q)
                                if (F_ISSET(tfp, TAGF_ERR) &&
                                    !F_ISSET(tfp, TAGF_ERR_WARN)) {
                                        errno = tfp->errnum;



Home | Main Index | Thread Index | Old Index