Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/nvi/dist Make sure that the next pointers are N...
details: https://anonhg.NetBSD.org/src/rev/710034f41a2e
branches: trunk
changeset: 324976:710034f41a2e
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 28 23:19:43 2013 +0000
description:
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.
diffstat:
external/bsd/nvi/dist/common/exf.c | 4 +++-
external/bsd/nvi/dist/common/main.c | 4 +++-
external/bsd/nvi/dist/common/screen.c | 3 ++-
external/bsd/nvi/dist/ex/ex_edit.c | 3 ++-
external/bsd/nvi/dist/ex/ex_tag.c | 3 ++-
external/bsd/nvi/dist/vi/v_ex.c | 3 ++-
external/bsd/nvi/dist/vi/vi.c | 4 +++-
external/bsd/nvi/dist/vi/vs_split.c | 4 +++-
8 files changed, 20 insertions(+), 8 deletions(-)
diffs (167 lines):
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/common/exf.c
--- a/external/bsd/nvi/dist/common/exf.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/common/exf.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
/* 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 @@
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);
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/common/main.c
--- a/external/bsd/nvi/dist/common/main.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/common/main.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
*/
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;
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/common/screen.c
--- a/external/bsd/nvi/dist/common/screen.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/common/screen.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
/* 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);
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/ex/ex_edit.c
--- a/external/bsd/nvi/dist/ex/ex_edit.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/ex/ex_edit.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
/* 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;
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/ex/ex_tag.c
--- a/external/bsd/nvi/dist/ex/ex_tag.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/ex/ex_tag.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
/* 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;
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/vi/v_ex.c
--- a/external/bsd/nvi/dist/vi/v_ex.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/vi/v_ex.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
/* 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;
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/vi/vi.c
--- a/external/bsd/nvi/dist/vi/vi.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/vi/vi.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
_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 @@
/* 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;
diff -r 35db8017e738 -r 710034f41a2e external/bsd/nvi/dist/vi/vs_split.c
--- a/external/bsd/nvi/dist/vi/vs_split.c Thu Nov 28 22:39:29 2013 +0000
+++ b/external/bsd/nvi/dist/vi/vs_split.c Thu Nov 28 23:19:43 2013 +0000
@@ -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 @@
* 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 @@
* 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);
/*
Home |
Main Index |
Thread Index |
Old Index