Module Name: src
Committed By: christos
Date: Thu Nov 28 23:19:43 UTC 2013
Modified Files:
src/external/bsd/nvi/dist/common: exf.c main.c screen.c
src/external/bsd/nvi/dist/ex: ex_edit.c ex_tag.c
src/external/bsd/nvi/dist/vi: v_ex.c vi.c vs_split.c
Log Message:
Make sure that the next pointers are NULL when we insert screens in the list.
This avoids the problem when screens are re-used that have stale pointers in
them. This was not an issue with circleq's because all the pointers used to
be updated.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/common/exf.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/common/main.c \
src/external/bsd/nvi/dist/common/screen.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/ex/ex_edit.c
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/nvi/dist/ex/ex_tag.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/vi/v_ex.c \
src/external/bsd/nvi/dist/vi/vi.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/dist/vi/vs_split.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/nvi/dist/common/exf.c
diff -u src/external/bsd/nvi/dist/common/exf.c:1.5 src/external/bsd/nvi/dist/common/exf.c:1.6
--- src/external/bsd/nvi/dist/common/exf.c:1.5 Wed Nov 27 15:31:01 2013
+++ src/external/bsd/nvi/dist/common/exf.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: exf.c,v 1.5 2013/11/27 20:31:01 tron Exp $ */
+/* $NetBSD: exf.c,v 1.6 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -402,6 +402,7 @@ no_lock:
/* Switch... */
++ep->refcnt;
+ TAILQ_NEXT(sp, q) = NULL;
TAILQ_INSERT_HEAD(&ep->scrq, sp, eq);
sp->ep = ep;
sp->frp = frp;
@@ -691,6 +692,7 @@ file_end(SCR *sp, EXF *ep, int force)
if ((sp->db_error = db_close(ep->db)) != 0 &&
!force) {
msgq_str(sp, M_DBERR, frp->name, "241|%s: close");
+ TAILQ_NEXT(sp, q) = NULL;
TAILQ_INSERT_HEAD(&ep->scrq, sp, eq);
++ep->refcnt;
return (1);
Index: src/external/bsd/nvi/dist/common/main.c
diff -u src/external/bsd/nvi/dist/common/main.c:1.3 src/external/bsd/nvi/dist/common/main.c:1.4
--- src/external/bsd/nvi/dist/common/main.c:1.3 Mon Nov 25 17:43:46 2013
+++ src/external/bsd/nvi/dist/common/main.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: main.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -233,12 +233,14 @@ editor(WIN *wp, int argc, char **argv)
*/
if (screen_init(gp, NULL, &sp)) {
if (sp != NULL) {
+ TAILQ_NEXT(sp, q) = NULL;
TAILQ_INSERT_HEAD(&wp->scrq, sp, q);
sp->wp = wp;
}
goto err;
}
F_SET(sp, SC_EX);
+ TAILQ_NEXT(sp, q) = NULL;
TAILQ_INSERT_HEAD(&wp->scrq, sp, q);
sp->wp = wp;
Index: src/external/bsd/nvi/dist/common/screen.c
diff -u src/external/bsd/nvi/dist/common/screen.c:1.3 src/external/bsd/nvi/dist/common/screen.c:1.4
--- src/external/bsd/nvi/dist/common/screen.c:1.3 Mon Nov 25 17:43:46 2013
+++ src/external/bsd/nvi/dist/common/screen.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: screen.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -227,6 +227,7 @@ screen_next(SCR *sp)
/* Try the hidden queue; if found, move screen to the display queue. */
if ((next = TAILQ_FIRST(&gp->hq)) != NULL) {
TAILQ_REMOVE(&gp->hq, next, q);
+ TAILQ_NEXT(next, q) = NULL;
TAILQ_INSERT_HEAD(&wp->scrq, next, q);
next->wp = sp->wp;
return (next);
Index: src/external/bsd/nvi/dist/ex/ex_edit.c
diff -u src/external/bsd/nvi/dist/ex/ex_edit.c:1.3 src/external/bsd/nvi/dist/ex/ex_edit.c:1.4
--- src/external/bsd/nvi/dist/ex/ex_edit.c:1.3 Mon Nov 25 17:43:46 2013
+++ src/external/bsd/nvi/dist/ex/ex_edit.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_edit.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: ex_edit.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -129,6 +129,7 @@ ex_N_edit(SCR *sp, EXCMD *cmdp, FREF *fr
/* Copy file state, keep the screen and cursor the same. */
new->ep = sp->ep;
++new->ep->refcnt;
+ TAILQ_NEXT(new, eq) = NULL;
TAILQ_INSERT_HEAD(&new->ep->scrq, new, eq);
new->frp = frp;
Index: src/external/bsd/nvi/dist/ex/ex_tag.c
diff -u src/external/bsd/nvi/dist/ex/ex_tag.c:1.7 src/external/bsd/nvi/dist/ex/ex_tag.c:1.8
--- src/external/bsd/nvi/dist/ex/ex_tag.c:1.7 Wed Nov 27 22:15:02 2013
+++ src/external/bsd/nvi/dist/ex/ex_tag.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_tag.c,v 1.7 2013/11/28 03:15:02 christos Exp $ */
+/* $NetBSD: ex_tag.c,v 1.8 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -311,6 +311,7 @@ ex_tag_Nswitch(SCR *sp, TAG *tp, int for
/* Copy file state. */
new->ep = sp->ep;
++new->ep->refcnt;
+ TAILQ_NEXT(new, eq) = NULL;
TAILQ_INSERT_HEAD(&new->ep->scrq, new, eq);
new->frp = tp->frp;
Index: src/external/bsd/nvi/dist/vi/v_ex.c
diff -u src/external/bsd/nvi/dist/vi/v_ex.c:1.3 src/external/bsd/nvi/dist/vi/v_ex.c:1.4
--- src/external/bsd/nvi/dist/vi/v_ex.c:1.3 Mon Nov 25 17:43:46 2013
+++ src/external/bsd/nvi/dist/vi/v_ex.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: v_ex.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: v_ex.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -523,6 +523,7 @@ v_ecl(SCR *sp)
/* Attach to the screen. */
new->ep = wp->ccl_sp->ep;
++new->ep->refcnt;
+ TAILQ_NEXT(new, eq) = NULL;
TAILQ_INSERT_HEAD(&new->ep->scrq, new, eq);
new->frp = wp->ccl_sp->frp;
Index: src/external/bsd/nvi/dist/vi/vi.c
diff -u src/external/bsd/nvi/dist/vi/vi.c:1.3 src/external/bsd/nvi/dist/vi/vi.c:1.4
--- src/external/bsd/nvi/dist/vi/vi.c:1.3 Mon Nov 25 17:43:46 2013
+++ src/external/bsd/nvi/dist/vi/vi.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: vi.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: vi.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -1033,6 +1033,7 @@ v_dtoh(SCR *sp)
_HMAP(tsp) = NULL;
}
TAILQ_REMOVE(&wp->scrq, tsp, q);
+ TAILQ_NEXT(tsp, q) = NULL;
TAILQ_INSERT_TAIL(&gp->hq, tsp, q);
/* XXXX Change if hidden screens per window */
tsp->wp = 0;
@@ -1041,6 +1042,7 @@ v_dtoh(SCR *sp)
/* Move current screen back to the display queue. */
TAILQ_REMOVE(&gp->hq, sp, q);
+ TAILQ_NEXT(sp, q) = NULL;
TAILQ_INSERT_TAIL(&wp->scrq, sp, q);
sp->wp = wp;
Index: src/external/bsd/nvi/dist/vi/vs_split.c
diff -u src/external/bsd/nvi/dist/vi/vs_split.c:1.4 src/external/bsd/nvi/dist/vi/vs_split.c:1.5
--- src/external/bsd/nvi/dist/vi/vs_split.c:1.4 Wed Nov 27 09:21:31 2013
+++ src/external/bsd/nvi/dist/vi/vs_split.c Thu Nov 28 18:19:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: vs_split.c,v 1.4 2013/11/27 14:21:31 mrg Exp $ */
+/* $NetBSD: vs_split.c,v 1.5 2013/11/28 23:19:43 christos Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -317,6 +317,7 @@ vs_insert(SCR *sp, WIN *wp)
* If we reached the end, this screen goes there. Otherwise,
* put it before or after the screen where we stopped.
*/
+ TAILQ_NEXT(sp, q) = NULL;
if (tsp == NULL) {
TAILQ_INSERT_TAIL(&wp->scrq, sp, q);
} else if (tsp->roff < sp->roff ||
@@ -781,6 +782,7 @@ vs_swap(SCR *sp, SCR **nspp, const char
* code will move the old one to the background queue.
*/
TAILQ_REMOVE(&gp->hq, nsp, q);
+ TAILQ_NEXT(nsp, q) = NULL;
TAILQ_INSERT_AFTER(&wp->scrq, sp, nsp, q);
/*