From aa1051802050e4b3f8e101d6829c1b31e1e67226 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 29 Dec 2000 18:04:54 +0000 Subject: Convert to use the macros rather than fiddling with the queue structure internals. Reviewed by: markm --- usr.sbin/mtree/excludes.c | 2 +- usr.sbin/pw/pw.c | 4 ++-- usr.sbin/pw/pw_user.c | 4 ++-- usr.sbin/tzsetup/tzsetup.c | 14 ++++++-------- 4 files changed, 11 insertions(+), 13 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/mtree/excludes.c b/usr.sbin/mtree/excludes.c index 47ab298..624b57a 100644 --- a/usr.sbin/mtree/excludes.c +++ b/usr.sbin/mtree/excludes.c @@ -102,7 +102,7 @@ check_excludes(const char *fname, const char *path) /* fnmatch(3) has a funny return value convention... */ #define MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0) - for (e = excludes.lh_first; e != 0; e = e->link.le_next) { + LIST_FOREACH(e, &excludes, link) { if (e->pathname && MATCH(e->glob, path) || MATCH(e->glob, fname)) return 1; diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index ca3a10a..dd23df9 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -420,10 +420,10 @@ cmdhelp(int mode, int which) struct carg * getarg(struct cargs * _args, int ch) { - struct carg *c = _args->lh_first; + struct carg *c = LIST_FIRST(_args); while (c != NULL && c->ch != ch) - c = c->list.le_next; + c = LIST_NEXT(c, list); return c; } diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index c4e66b4..26615b7 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -891,9 +891,9 @@ pw_gidpolicy(struct userconf * cnf, struct cargs * args, char *nam, gid_t prefer if ((grp = GETGRNAM(nam)) != NULL) gid = grp->gr_gid; } - a_gid = grpargs.lh_first; + a_gid = LIST_FIRST(&grpargs); while (a_gid != NULL) { - struct carg *t = a_gid->list.le_next; + struct carg *t = LIST_NEXT(a_gid, list); LIST_REMOVE(a_gid, list); a_gid = t; } diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 5a12261..ee5672e 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -378,12 +378,11 @@ make_menus(void) if (cp->nzones < 0) { cp->continent->nitems++; } else { - for (zp = cp->zones.tqh_first; zp; - zp = zp->link.tqe_next) { + TAILQ_FOREACH(zp, &cp->zones, link) { cont = zp->continent; - for (zp2 = cp->zones.tqh_first; + for (zp2 = TAILQ_FIRST(&cp->zones); zp2->continent != cont; - zp2 = zp2->link.tqe_next) + zp2 = TAILQ_NEXT(zp2, link)) ; if (zp2 == zp) zp->continent->nitems++; @@ -428,8 +427,7 @@ make_menus(void) if (cp->submenu == 0) errx(1, "malloc for submenu"); cp->nzones = 0; - for (zp = cp->zones.tqh_first; zp; - zp = zp->link.tqe_next) { + TAILQ_FOREACH(zp, &cp->zones, link) { cont = zp->continent; dmi = &cp->submenu[cp->nzones]; memset(dmi, 0, sizeof *dmi); @@ -441,9 +439,9 @@ make_menus(void) dmi->selected = 0; dmi->data = zp; - for (zp2 = cp->zones.tqh_first; + for (zp2 = TAILQ_FIRST(&cp->zones); zp2->continent != cont; - zp2 = zp2->link.tqe_next) + zp2 = TAILQ_NEXT(zp2, link)) ; if (zp2 != zp) continue; -- cgit v1.1