summaryrefslogtreecommitdiff
path: root/usr.bin/vi/ex
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-12-01 19:26:38 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-12-01 19:26:38 +0000
commit811bccffe047eed7c086c37d20533fcc372bb4e7 (patch)
treed1a159eaa8d38ccb8705e786104454cfd17fe6dd /usr.bin/vi/ex
parent81f70a2c11c6dd3cfbdc8b3a75201127bbef3b0f (diff)
Change the tags queue from CIRCLEQ to TAILQ.
ok zhuk@
Diffstat (limited to 'usr.bin/vi/ex')
-rw-r--r--usr.bin/vi/ex/ex_cscope.c12
-rw-r--r--usr.bin/vi/ex/ex_tag.c38
-rw-r--r--usr.bin/vi/ex/tag.h6
3 files changed, 28 insertions, 28 deletions
diff --git a/usr.bin/vi/ex/ex_cscope.c b/usr.bin/vi/ex/ex_cscope.c
index 5edba61f4f8..38200ee2359 100644
--- a/usr.bin/vi/ex/ex_cscope.c
+++ b/usr.bin/vi/ex/ex_cscope.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_cscope.c,v 1.19 2013/12/01 16:47:59 krw Exp $ */
+/* $OpenBSD: ex_cscope.c,v 1.20 2013/12/01 19:26:37 krw Exp $ */
/*-
* Copyright (c) 1994, 1996
@@ -462,11 +462,11 @@ cscope_find(sp, cmdp, pattern)
if (TAILQ_EMPTY(&exp->tq)) {
/* Initialize the `local context' tag queue structure. */
CALLOC_GOTO(sp, rtqp, TAGQ *, 1, sizeof(TAGQ));
- CIRCLEQ_INIT(&rtqp->tagq);
+ TAILQ_INIT(&rtqp->tagq);
/* Initialize and link in its tag structure. */
CALLOC_GOTO(sp, rtp, TAG *, 1, sizeof(TAG));
- CIRCLEQ_INSERT_HEAD(&rtqp->tagq, rtp, q);
+ TAILQ_INSERT_HEAD(&rtqp->tagq, rtp, q);
rtqp->current = rtp;
}
@@ -513,7 +513,7 @@ cscope_find(sp, cmdp, pattern)
return (0);
}
- tqp->current = CIRCLEQ_FIRST(&tqp->tagq);
+ tqp->current = TAILQ_FIRST(&tqp->tagq);
/* Try to switch to the first tag. */
force = FL_ISSET(cmdp->iflags, E_C_FORCE);
@@ -634,7 +634,7 @@ usage: (void)csc_help(sp, "find");
CALLOC(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + tlen + 3);
if (tqp == NULL)
return (NULL);
- CIRCLEQ_INIT(&tqp->tagq);
+ TAILQ_INIT(&tqp->tagq);
tqp->tag = tqp->buf;
tqp->tag[0] = pattern[0];
tqp->tag[1] = ' ';
@@ -751,7 +751,7 @@ parse(sp, csc, tqp, matchesp)
tp->search = tp->fname + tp->fnlen + 1;
memcpy(tp->search, search, (tp->slen = slen) + 1);
}
- CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
+ TAILQ_INSERT_TAIL(&tqp->tagq, tp, q);
++*matchesp;
}
diff --git a/usr.bin/vi/ex/ex_tag.c b/usr.bin/vi/ex/ex_tag.c
index a9bd0e63fbd..cba6c39ed2a 100644
--- a/usr.bin/vi/ex/ex_tag.c
+++ b/usr.bin/vi/ex/ex_tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_tag.c,v 1.16 2013/12/01 16:47:59 krw Exp $ */
+/* $OpenBSD: ex_tag.c,v 1.17 2013/12/01 19:26:37 krw Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -148,11 +148,11 @@ ex_tag_push(sp, cmdp)
if (TAILQ_EMPTY(&exp->tq)) {
/* Initialize the `local context' tag queue structure. */
CALLOC_GOTO(sp, rtqp, TAGQ *, 1, sizeof(TAGQ));
- CIRCLEQ_INIT(&rtqp->tagq);
+ TAILQ_INIT(&rtqp->tagq);
/* Initialize and link in its tag structure. */
CALLOC_GOTO(sp, rtp, TAG *, 1, sizeof(TAG));
- CIRCLEQ_INSERT_HEAD(&rtqp->tagq, rtp, q);
+ TAILQ_INSERT_HEAD(&rtqp->tagq, rtp, q);
rtqp->current = rtp;
}
@@ -170,14 +170,14 @@ ex_tag_push(sp, cmdp)
/* Try to switch to the tag. */
force = FL_ISSET(cmdp->iflags, E_C_FORCE);
if (F_ISSET(cmdp, E_NEWSCREEN)) {
- if (ex_tag_Nswitch(sp, CIRCLEQ_FIRST(&tqp->tagq), force))
+ if (ex_tag_Nswitch(sp, TAILQ_FIRST(&tqp->tagq), force))
goto err;
/* Everything else gets done in the new screen. */
sp = sp->nextdisp;
exp = EXP(sp);
} else
- if (ex_tag_nswitch(sp, CIRCLEQ_FIRST(&tqp->tagq), force))
+ if (ex_tag_nswitch(sp, TAILQ_FIRST(&tqp->tagq), force))
goto err;
/*
@@ -246,7 +246,7 @@ ex_tag_next(sp, cmdp)
tag_msg(sp, TAG_EMPTY, NULL);
return (1);
}
- if ((tp = CIRCLEQ_NEXT(tqp->current, q)) == CIRCLEQ_END(&tqp->tagq)) {
+ if ((tp = TAILQ_NEXT(tqp->current, q)) == NULL) {
msgq(sp, M_ERR, "282|Already at the last tag of this group");
return (1);
}
@@ -281,7 +281,7 @@ ex_tag_prev(sp, cmdp)
tag_msg(sp, TAG_EMPTY, NULL);
return (0);
}
- if ((tp = CIRCLEQ_PREV(tqp->current, q)) == CIRCLEQ_END(&tqp->tagq)) {
+ if ((tp = TAILQ_PREV(tqp->current, _tagqh, q)) == NULL) {
msgq(sp, M_ERR, "255|Already at the first tag of this group");
return (1);
}
@@ -605,8 +605,8 @@ ex_tag_display(sp)
if (INTERRUPTED(sp))
break;
++cnt;
- CIRCLEQ_FOREACH(tp, &tqp->tagq, q) {
- if (tp == CIRCLEQ_FIRST(&tqp->tagq))
+ TAILQ_FOREACH(tp, &tqp->tagq, q) {
+ if (tp == TAILQ_FIRST(&tqp->tagq))
(void)ex_printf(sp, "%2d ", cnt);
else
(void)ex_printf(sp, " ");
@@ -621,7 +621,7 @@ ex_tag_display(sp)
if (tqp->current == tp)
(void)ex_printf(sp, "*");
- if (tp == CIRCLEQ_FIRST(&tqp->tagq) && tqp->tag != NULL &&
+ if (tp == TAILQ_FIRST(&tqp->tagq) && tqp->tag != NULL &&
(sp->cols - L_NAME) >= L_TAG + L_SPACE) {
len = strlen(tqp->tag);
if (len > sp->cols - (L_NAME + L_SPACE))
@@ -658,13 +658,13 @@ ex_tag_copy(orig, sp)
TAILQ_FOREACH(aqp, &oexp->tq, q) {
if (tagq_copy(sp, aqp, &tqp))
return (1);
- CIRCLEQ_FOREACH(ap, &aqp->tagq, q) {
+ TAILQ_FOREACH(ap, &aqp->tagq, q) {
if (tag_copy(sp, ap, &tp))
return (1);
/* Set the current pointer. */
if (aqp->current == ap)
tqp->current = tp;
- CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
+ TAILQ_INSERT_TAIL(&tqp->tagq, tp, q);
}
TAILQ_INSERT_TAIL(&nexp->tq, tqp, q);
}
@@ -727,7 +727,7 @@ tagq_copy(sp, otqp, tqpp)
MALLOC_RET(sp, tqp, TAGQ *, len);
memcpy(tqp, otqp, len);
- CIRCLEQ_INIT(&tqp->tagq);
+ TAILQ_INIT(&tqp->tagq);
tqp->current = NULL;
if (otqp->tag != NULL)
tqp->tag = tqp->buf;
@@ -799,8 +799,8 @@ tagq_free(sp, tqp)
TAG *tp;
exp = EXP(sp);
- while ((tp = CIRCLEQ_FIRST(&tqp->tagq)) != CIRCLEQ_END(&tqp->tagq)) {
- CIRCLEQ_REMOVE(&tqp->tagq, tp, q);
+ while ((tp = TAILQ_FIRST(&tqp->tagq))) {
+ TAILQ_REMOVE(&tqp->tagq, tp, q);
free(tp);
}
/*
@@ -998,7 +998,7 @@ ctag_slist(sp, tag)
/* Allocate and initialize the tag queue structure. */
len = strlen(tag);
CALLOC_GOTO(sp, tqp, TAGQ *, 1, sizeof(TAGQ) + len + 1);
- CIRCLEQ_INIT(&tqp->tagq);
+ TAILQ_INIT(&tqp->tagq);
tqp->tag = tqp->buf;
memcpy(tqp->tag, tag, (tqp->tlen = len) + 1);
@@ -1015,7 +1015,7 @@ ctag_slist(sp, tag)
F_CLR(tfp, TAGF_ERR | TAGF_ERR_WARN);
/* Check to see if we found anything. */
- if (CIRCLEQ_FIRST(&tqp->tagq) == CIRCLEQ_END(&tqp->tagq)) {
+ if (TAILQ_EMPTY(&tqp->tagq)) {
msgq_str(sp, M_ERR, tag, "162|%s: tag not found");
if (echk)
TAILQ_FOREACH(tfp, &exp->tagfq, q)
@@ -1029,7 +1029,7 @@ ctag_slist(sp, tag)
return (NULL);
}
- tqp->current = CIRCLEQ_FIRST(&tqp->tagq);
+ tqp->current = TAILQ_FIRST(&tqp->tagq);
return (tqp);
alloc_err:
@@ -1166,7 +1166,7 @@ corrupt: p = msg_print(sp, tname, &nf1);
tp->fnlen = dlen + nlen;
tp->search = tp->fname + tp->fnlen + 1;
memcpy(tp->search, search, (tp->slen = slen) + 1);
- CIRCLEQ_INSERT_TAIL(&tqp->tagq, tp, q);
+ TAILQ_INSERT_TAIL(&tqp->tagq, tp, q);
}
alloc_err:
diff --git a/usr.bin/vi/ex/tag.h b/usr.bin/vi/ex/tag.h
index ec72b1c8d13..81b1d20c6f0 100644
--- a/usr.bin/vi/ex/tag.h
+++ b/usr.bin/vi/ex/tag.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tag.h,v 1.4 2013/12/01 16:47:59 krw Exp $ */
+/* $OpenBSD: tag.h,v 1.5 2013/12/01 19:26:37 krw Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -76,7 +76,7 @@ struct _tagf { /* Tag files. */
* tagtop: discard all Q
*/
struct _tag { /* Tag list. */
- CIRCLEQ_ENTRY(_tag) q; /* Linked list of tags. */
+ TAILQ_ENTRY(_tag) q; /* Linked list of tags. */
/* Tag pop/return information. */
FREF *frp; /* Saved file. */
@@ -95,7 +95,7 @@ struct _tag { /* Tag list. */
struct _tagq { /* Tag queue. */
TAILQ_ENTRY(_tagq) q; /* Linked list of tag queues. */
/* This queue's tag list. */
- CIRCLEQ_HEAD(_tagqh, _tag) tagq;
+ TAILQ_HEAD(_tagqh, _tag) tagq;
TAG *current; /* Current TAG within the queue. */