diff options
Diffstat (limited to 'usr.bin/vi/common/put.c')
-rw-r--r-- | usr.bin/vi/common/put.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/vi/common/put.c b/usr.bin/vi/common/put.c index 08ee3b79240..9e855818ac2 100644 --- a/usr.bin/vi/common/put.c +++ b/usr.bin/vi/common/put.c @@ -1,4 +1,4 @@ -/* $OpenBSD: put.c,v 1.6 2002/02/16 21:27:57 millert Exp $ */ +/* $OpenBSD: put.c,v 1.7 2005/10/17 19:12:16 otto Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -65,7 +65,7 @@ put(sp, cbp, namep, cp, rp, append) return (1); } } - tp = cbp->textq.cqh_first; + tp = CIRCLEQ_FIRST(&cbp->textq); /* * It's possible to do a put into an empty file, meaning that the cut @@ -87,7 +87,8 @@ put(sp, cbp, namep, cp, rp, append) return (1); if (lno == 0) { for (; tp != (void *)&cbp->textq; - ++lno, ++sp->rptlines[L_ADDED], tp = tp->q.cqe_next) + ++lno, ++sp->rptlines[L_ADDED], + tp = CIRCLEQ_NEXT(tp, q)) if (db_append(sp, 1, lno, tp->lb, tp->len)) return (1); rp->lno = 1; @@ -100,8 +101,8 @@ put(sp, cbp, namep, cp, rp, append) if (F_ISSET(cbp, CB_LMODE)) { lno = append ? cp->lno : cp->lno - 1; rp->lno = lno + 1; - for (; tp != (void *)&cbp->textq; - ++lno, ++sp->rptlines[L_ADDED], tp = tp->q.cqe_next) + for (; tp != CIRCLEQ_END(&cbp->textq); + ++lno, ++sp->rptlines[L_ADDED], tp = CIRCLEQ_NEXT(tp, q)) if (db_append(sp, 1, lno, tp->lb, tp->len)) return (1); rp->cno = 0; @@ -163,7 +164,7 @@ put(sp, cbp, namep, cp, rp, append) * the intermediate lines, because the line changes will lose * the cached line. */ - if (tp->q.cqe_next == (void *)&cbp->textq) { + if (CIRCLEQ_NEXT(tp, q) == CIRCLEQ_END(&cbp->textq)) { if (clen > 0) { memcpy(t, p, clen); t += clen; @@ -213,9 +214,9 @@ put(sp, cbp, namep, cp, rp, append) } /* Output any intermediate lines in the CB. */ - for (tp = tp->q.cqe_next; - tp->q.cqe_next != (void *)&cbp->textq; - ++lno, ++sp->rptlines[L_ADDED], tp = tp->q.cqe_next) + for (tp = CIRCLEQ_NEXT(tp, q); + CIRCLEQ_NEXT(tp, q) != CIRCLEQ_END(&cbp->textq); + ++lno, ++sp->rptlines[L_ADDED], tp = CIRCLEQ_NEXT(tp, q)) if (db_append(sp, 1, lno, tp->lb, tp->len)) goto err; |