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 Revert all previous TAILQ_NEXT() = NUL...
details: https://anonhg.NetBSD.org/src/rev/4a7f8a36e01d
branches: trunk
changeset: 325033:4a7f8a36e01d
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 01 02:34:54 2013 +0000
description:
Revert all previous TAILQ_NEXT() = NULL, changes, checks against
NULL vip's and removal of screens from queues. Instead introduce
a new screen_end1() function that can be used to clean screens that
are not associated with queues yet. Pointed out by chuq@
diffstat:
external/bsd/nvi/dist/common/exf.c | 4 +--
external/bsd/nvi/dist/common/gs.c | 14 +++---------
external/bsd/nvi/dist/common/main.c | 4 +--
external/bsd/nvi/dist/common/screen.c | 36 ++++++++++++++++++++--------------
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_msg.c | 4 +--
external/bsd/nvi/dist/vi/vs_refresh.c | 5 +--
external/bsd/nvi/dist/vi/vs_split.c | 4 +--
11 files changed, 35 insertions(+), 49 deletions(-)
diffs (truncated from 310 to 300 lines):
diff -r 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/common/exf.c
--- a/external/bsd/nvi/dist/common/exf.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/common/exf.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exf.c,v 1.6 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: exf.c,v 1.7 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -402,7 +402,6 @@
/* Switch... */
++ep->refcnt;
- TAILQ_NEXT(sp, q) = NULL;
TAILQ_INSERT_HEAD(&ep->scrq, sp, eq);
sp->ep = ep;
sp->frp = frp;
@@ -692,7 +691,6 @@
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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/common/gs.c
--- a/external/bsd/nvi/dist/common/gs.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/common/gs.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gs.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
+/* $NetBSD: gs.c,v 1.4 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 2000
* Sven Verdoolaege. All rights reserved.
@@ -112,10 +112,8 @@
(void)file_end(wp->ccl_sp, NULL, 1);
(void)screen_end(wp->ccl_sp);
}
- while ((sp = TAILQ_FIRST(&wp->scrq)) != NULL) {
- TAILQ_REMOVE(&wp->scrq, sp, q);
+ while ((sp = TAILQ_FIRST(&wp->scrq)) != NULL)
(void)screen_end(sp);
- }
/* Free key input queue. */
if (wp->i_event != NULL)
@@ -150,14 +148,10 @@
WIN *wp;
/* If there are any remaining screens, kill them off. */
- while ((wp = TAILQ_FIRST(&gp->dq)) != NULL) {
- TAILQ_REMOVE(&gp->dq, wp, q);
+ while ((wp = TAILQ_FIRST(&gp->dq)) != NULL)
(void)win_end(wp);
- }
- while ((sp = TAILQ_FIRST(&gp->hq)) != NULL) {
- TAILQ_REMOVE(&gp->hq, sp, q);
+ while ((sp = TAILQ_FIRST(&gp->hq)) != NULL)
(void)screen_end(sp);
- }
#ifdef HAVE_PERL_INTERP
perl_end(gp);
diff -r 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/common/main.c
--- a/external/bsd/nvi/dist/common/main.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/common/main.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: main.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -233,14 +233,12 @@
*/
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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/common/screen.c
--- a/external/bsd/nvi/dist/common/screen.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/common/screen.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: screen.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -29,6 +29,7 @@
#include "common.h"
#include "../vi/vi.h"
+static int screen_end1(SCR *, int);
/*
* screen_init --
* Do the default initialization of an SCR structure.
@@ -120,25 +121,18 @@
*spp = sp;
return (0);
-err: screen_end(sp);
+err: screen_end1(sp, 0);
return (1);
}
-/*
- * screen_end --
- * Release a screen, no matter what had (and had not) been
- * initialized.
- *
- * PUBLIC: int screen_end __P((SCR *));
- */
-int
-screen_end(SCR *sp)
+static int
+screen_end1(SCR *sp, int init)
{
int rval;
/* If multiply referenced, just decrement the count and return. */
- if (--sp->refcnt != 0)
- return (0);
+ if (--sp->refcnt != 0)
+ return (0);
/*
* Remove the screen from the displayed queue.
@@ -146,7 +140,7 @@
* If a created screen failed during initialization, it may not
* be linked into the chain.
*/
- if (TAILQ_NEXT(sp, q) != NULL)
+ if (init)
TAILQ_REMOVE(&sp->wp->scrq, sp, q);
/* The screen is no longer real. */
@@ -203,6 +197,19 @@
}
/*
+ * screen_end --
+ * Release a screen, no matter what had (and had not) been
+ * initialized.
+ *
+ * PUBLIC: int screen_end __P((SCR *));
+ */
+int
+screen_end(SCR *sp)
+{
+ return screen_end1(sp, 1);
+}
+
+/*
* screen_next --
* Return the next screen in the queue.
*
@@ -227,7 +234,6 @@
/* 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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/ex/ex_edit.c
--- a/external/bsd/nvi/dist/ex/ex_edit.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/ex/ex_edit.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_edit.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: ex_edit.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -129,7 +129,6 @@
/* 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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/ex/ex_tag.c
--- a/external/bsd/nvi/dist/ex/ex_tag.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/ex/ex_tag.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ex_tag.c,v 1.8 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: ex_tag.c,v 1.9 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -311,7 +311,6 @@
/* 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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/vi/v_ex.c
--- a/external/bsd/nvi/dist/vi/v_ex.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/vi/v_ex.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: v_ex.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: v_ex.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -523,7 +523,6 @@
/* 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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/vi/vi.c
--- a/external/bsd/nvi/dist/vi/vi.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/vi/vi.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vi.c,v 1.4 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: vi.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -1033,7 +1033,6 @@
_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;
@@ -1042,7 +1041,6 @@
/* 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 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/vi/vs_msg.c
--- a/external/bsd/nvi/dist/vi/vs_msg.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/vi/vs_msg.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vs_msg.c,v 1.4 2013/11/26 16:48:01 christos Exp $ */
+/* $NetBSD: vs_msg.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -661,8 +661,6 @@
gp = sp->gp;
wp = sp->wp;
vip = VIP(sp);
- if (vip == NULL)
- return 0;
if (csp == NULL)
csp = sp;
diff -r 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/vi/vs_refresh.c
--- a/external/bsd/nvi/dist/vi/vs_refresh.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/vi/vs_refresh.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vs_refresh.c,v 1.4 2013/11/26 16:48:01 christos Exp $ */
+/* $NetBSD: vs_refresh.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -81,8 +81,7 @@
(void)vs_paint(tsp,
(F_ISSET(VIP(tsp), VIP_CUR_INVALID) ?
UPDATE_CURSOR : 0) | UPDATE_SCREEN);
- if (VIP(sp))
- F_SET(VIP(sp), VIP_CUR_INVALID);
+ F_SET(VIP(sp), VIP_CUR_INVALID);
}
/*
diff -r 07016b311dec -r 4a7f8a36e01d external/bsd/nvi/dist/vi/vs_split.c
--- a/external/bsd/nvi/dist/vi/vs_split.c Sun Dec 01 02:21:58 2013 +0000
+++ b/external/bsd/nvi/dist/vi/vs_split.c Sun Dec 01 02:34:54 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vs_split.c,v 1.5 2013/11/28 23:19:43 christos Exp $ */
+/* $NetBSD: vs_split.c,v 1.6 2013/12/01 02:34:54 christos Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -317,7 +317,6 @@
* 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) {
Home |
Main Index |
Thread Index |
Old Index