summaryrefslogtreecommitdiff
path: root/usr.bin/vi/common
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-14 12:32:30 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-14 12:32:30 +0000
commit90dd085fee995925a925a00bbf035d6f03cca3c0 (patch)
tree46a962f512b5c4aabbe912fbb63af2e743101d6a /usr.bin/vi/common
parentb5c62abed48b5d9ad76863db362da20fa3f63928 (diff)
use sys/queue macros instead of accessing fields directly.
no binary change. ok krw@
Diffstat (limited to 'usr.bin/vi/common')
-rw-r--r--usr.bin/vi/common/api.c14
-rw-r--r--usr.bin/vi/common/line.c10
-rw-r--r--usr.bin/vi/common/main.c4
-rw-r--r--usr.bin/vi/common/put.c4
4 files changed, 15 insertions, 17 deletions
diff --git a/usr.bin/vi/common/api.c b/usr.bin/vi/common/api.c
index 1c796467336..23ed2ec0ac7 100644
--- a/usr.bin/vi/common/api.c
+++ b/usr.bin/vi/common/api.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: api.c,v 1.12 2003/04/15 08:08:02 deraadt Exp $ */
+/* $OpenBSD: api.c,v 1.13 2007/05/14 12:32:29 pyr Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -51,8 +51,7 @@ api_fscreen(id, name)
gp = __global_list;
/* Search the displayed list. */
- for (tsp = gp->dq.cqh_first;
- tsp != (void *)&gp->dq; tsp = tsp->q.cqe_next)
+ CIRCLEQ_FOREACH(tsp, &gp->dq, q)
if (name == NULL) {
if (id == tsp->id)
return (tsp);
@@ -60,8 +59,7 @@ api_fscreen(id, name)
return (tsp);
/* Search the hidden list. */
- for (tsp = gp->hq.cqh_first;
- tsp != (void *)&gp->hq; tsp = tsp->q.cqe_next)
+ CIRCLEQ_FOREACH(tsp, &gp->hq, q)
if (name == NULL) {
if (id == tsp->id)
return (tsp);
@@ -214,11 +212,11 @@ api_nextmark(sp, next, namep)
{
LMARK *mp;
- mp = sp->ep->marks.lh_first;
+ mp = LIST_FIRST(&sp->ep->marks);
if (next)
- for (; mp != NULL; mp = mp->q.le_next)
+ LIST_FOREACH(mp, &sp->ep->marks, q)
if (mp->name == *namep) {
- mp = mp->q.le_next;
+ mp = LIST_NEXT(mp, q);
break;
}
if (mp == NULL)
diff --git a/usr.bin/vi/common/line.c b/usr.bin/vi/common/line.c
index a6d02d99501..4ef445b268d 100644
--- a/usr.bin/vi/common/line.c
+++ b/usr.bin/vi/common/line.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: line.c,v 1.7 2006/01/08 21:05:39 miod Exp $ */
+/* $OpenBSD: line.c,v 1.8 2007/05/14 12:32:29 pyr Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -466,7 +466,7 @@ db_exist(sp, lno)
*/
if (ep->c_nlines != OOBLNO)
return (lno <= (F_ISSET(sp, SC_TINPUT) ?
- ep->c_nlines + (((TEXT *)sp->tiq.cqh_last)->lno -
+ ep->c_nlines + (((TEXT *)CIRCLEQ_LAST(&sp->tiq))->lno -
((TEXT *)CIRCLEQ_FIRST(&sp->tiq))->lno) : ep->c_nlines));
/* Go get the line. */
@@ -501,7 +501,7 @@ db_last(sp, lnop)
if (ep->c_nlines != OOBLNO) {
*lnop = ep->c_nlines;
if (F_ISSET(sp, SC_TINPUT))
- *lnop += ((TEXT *)sp->tiq.cqh_last)->lno -
+ *lnop += ((TEXT *)CIRCLEQ_LAST(&sp->tiq))->lno -
((TEXT *)CIRCLEQ_FIRST(&sp->tiq))->lno;
return (0);
}
@@ -529,8 +529,8 @@ db_last(sp, lnop)
/* Return the value. */
*lnop = (F_ISSET(sp, SC_TINPUT) &&
- ((TEXT *)sp->tiq.cqh_last)->lno > lno ?
- ((TEXT *)sp->tiq.cqh_last)->lno : lno);
+ ((TEXT *)CIRCLEQ_LAST(&sp->tiq))->lno > lno ?
+ ((TEXT *)CIRCLEQ_LAST(&sp->tiq))->lno : lno);
return (0);
}
diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c
index 7aea5e31ce1..9e37e008272 100644
--- a/usr.bin/vi/common/main.c
+++ b/usr.bin/vi/common/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.12 2006/01/08 21:05:39 miod Exp $ */
+/* $OpenBSD: main.c,v 1.13 2007/05/14 12:32:29 pyr Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -464,7 +464,7 @@ v_end(gp)
#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
{ FREF *frp;
/* Free FREF's. */
- while ((frp = gp->frefq.cqh_first) != (FREF *)&gp->frefq) {
+ while ((frp = CIRCLEQ_FIRST(&gp)) != CIRCLEQ_END(&gp->frefq)) {
CIRCLEQ_REMOVE(&gp->frefq, frp, q);
if (frp->name != NULL)
free(frp->name);
diff --git a/usr.bin/vi/common/put.c b/usr.bin/vi/common/put.c
index a4bb62245db..fcf15c2c06e 100644
--- a/usr.bin/vi/common/put.c
+++ b/usr.bin/vi/common/put.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: put.c,v 1.8 2006/01/08 21:05:39 miod Exp $ */
+/* $OpenBSD: put.c,v 1.9 2007/05/14 12:32:29 pyr Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -187,7 +187,7 @@ put(sp, cbp, namep, cp, rp, append)
* Last part of original line; check for space, reset
* the pointer into the buffer.
*/
- ltp = cbp->textq.cqh_last;
+ ltp = CIRCLEQ_LAST(&cbp->textq);
len = t - bp;
ADD_SPACE_RET(sp, bp, blen, ltp->len + clen);
t = bp + len;