diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-12-01 20:22:35 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-12-01 20:22:35 +0000 |
commit | 297a6a3de81b6eb2710d4129633c9b2f329b12e8 (patch) | |
tree | b27da49b89532d3b396d0617bfe51ec718d1a78a /usr.bin/vi/common | |
parent | e7b855ac45d346caa5b7215e8b5329a78b8708b9 (diff) |
Change the file reference queue from CIRCLEQ to TAILQ.
vi is now CIRCLEQ free!
ok zhuk@
Diffstat (limited to 'usr.bin/vi/common')
-rw-r--r-- | usr.bin/vi/common/exf.c | 12 | ||||
-rw-r--r-- | usr.bin/vi/common/gs.h | 6 | ||||
-rw-r--r-- | usr.bin/vi/common/main.c | 8 |
3 files changed, 12 insertions, 14 deletions
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c index 62259b72d07..f8121ef1e07 100644 --- a/usr.bin/vi/common/exf.c +++ b/usr.bin/vi/common/exf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exf.c,v 1.27 2013/04/29 00:28:23 okan Exp $ */ +/* $OpenBSD: exf.c,v 1.28 2013/12/01 20:22:34 krw Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -75,14 +75,12 @@ file_add(sp, name) */ gp = sp->gp; if (name != NULL) - CIRCLEQ_FOREACH(frp, &gp->frefq, q) { + TAILQ_FOREACH_SAFE(frp, &gp->frefq, q, tfrp) { if (frp->name == NULL) { - tfrp = CIRCLEQ_NEXT(frp, q); - CIRCLEQ_REMOVE(&gp->frefq, frp, q); + TAILQ_REMOVE(&gp->frefq, frp, q); if (frp->name != NULL) free(frp->name); free(frp); - frp = tfrp; continue; } if (!strcmp(frp->name, name)) @@ -107,7 +105,7 @@ file_add(sp, name) } /* Append into the chain of file names. */ - CIRCLEQ_INSERT_TAIL(&gp->frefq, frp, q); + TAILQ_INSERT_TAIL(&gp->frefq, frp, q); return (frp); } @@ -680,7 +678,7 @@ file_end(sp, ep, force) free(frp->tname); frp->tname = NULL; if (F_ISSET(frp, FR_TMPFILE)) { - CIRCLEQ_REMOVE(&sp->gp->frefq, frp, q); + TAILQ_REMOVE(&sp->gp->frefq, frp, q); if (frp->name != NULL) free(frp->name); free(frp); diff --git a/usr.bin/vi/common/gs.h b/usr.bin/vi/common/gs.h index e3c4609e57a..9466c23dafb 100644 --- a/usr.bin/vi/common/gs.h +++ b/usr.bin/vi/common/gs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gs.h,v 1.10 2013/11/28 22:12:40 krw Exp $ */ +/* $OpenBSD: gs.h,v 1.11 2013/12/01 20:22:34 krw Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -21,7 +21,7 @@ * The read-only bit follows the file name, not the file itself. */ struct _fref { - CIRCLEQ_ENTRY(_fref) q; /* Linked list of file references. */ + TAILQ_ENTRY(_fref) q; /* Linked list of file references. */ char *name; /* File name. */ char *tname; /* Backing temporary file name. */ @@ -71,7 +71,7 @@ struct _gs { void *tk_private; /* Tk/Tcl support private area. */ /* File references. */ - CIRCLEQ_HEAD(_frefh, _fref) frefq; + TAILQ_HEAD(_frefh, _fref) frefq; #define GO_COLUMNS 0 /* Global options: columns. */ #define GO_LINES 1 /* Global options: lines. */ diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c index e1a26f3a5a8..d7e407f2fdc 100644 --- a/usr.bin/vi/common/main.c +++ b/usr.bin/vi/common/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.21 2013/11/28 22:12:40 krw Exp $ */ +/* $OpenBSD: main.c,v 1.22 2013/12/01 20:22:34 krw Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -85,7 +85,7 @@ editor(gp, argc, argv) gp->noprint = DEFAULT_NOPRINT; /* Structures shared by screens so stored in the GS structure. */ - CIRCLEQ_INIT(&gp->frefq); + TAILQ_INIT(&gp->frefq); TAILQ_INIT(&gp->dcb_store.textq); LIST_INIT(&gp->cutq); LIST_INIT(&gp->seqq); @@ -468,8 +468,8 @@ v_end(gp) #if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY) { FREF *frp; /* Free FREF's. */ - while ((frp = CIRCLEQ_FIRST(&gp->frefq)) != CIRCLEQ_END(&gp->frefq)) { - CIRCLEQ_REMOVE(&gp->frefq, frp, q); + while ((frp = TAILQ_FIRST(&gp->frefq))) { + TAILQ_REMOVE(&gp->frefq, frp, q); if (frp->name != NULL) free(frp->name); if (frp->tname != NULL) |