Handle more cases where a screen has not been fully initialized (inserted

into the scrq) by calling screen_fini() instead of screen_end() where
appropriate. Pointed out by chuq.
This commit is contained in:
christos 2013-12-01 21:48:33 +00:00
parent 398232367e
commit a1f28fb37d
5 changed files with 24 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: screen.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/* $NetBSD: screen.c,v 1.6 2013/12/01 21:48:33 christos Exp $ */
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -121,7 +121,7 @@ mem: msgq(orig, M_SYSERR, NULL);
*spp = sp;
return (0);
err: screen_end1(sp, 0);
err: screen_fini(sp);
return (1);
}
@ -196,10 +196,21 @@ screen_end1(SCR *sp, int init)
return (rval);
}
/*
* screen_fini --
* Release a screen, that has not been chained to the screen queues.
*
* PUBLIC: int screen_fini __P((SCR *));
*/
int
screen_fini(SCR *sp)
{
return screen_end1(sp, 0);
}
/*
* screen_end --
* Release a screen, no matter what had (and had not) been
* initialized.
* Release a screen, that has been chained to the screen queues.
*
* PUBLIC: int screen_end __P((SCR *));
*/
@ -208,7 +219,6 @@ screen_end(SCR *sp)
{
return screen_end1(sp, 1);
}
/*
* screen_next --
* Return the next screen in the queue.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ex_args.c,v 1.2 2013/11/22 15:52:05 christos Exp $ */
/* $NetBSD: ex_args.c,v 1.3 2013/12/01 21:48:33 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -141,7 +141,7 @@ ex_N_next(SCR *sp, EXCMD *cmdp)
if (screen_init(sp->gp, sp, &new))
return (1);
if (vs_split(sp, new, 0)) {
(void)screen_end(new);
(void)screen_fini(new);
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ex_edit.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/* $NetBSD: ex_edit.c,v 1.6 2013/12/01 21:48:33 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -120,7 +120,7 @@ ex_N_edit(SCR *sp, EXCMD *cmdp, FREF *frp, int attach)
return (1);
if ((cmdp->cmd == &cmds[C_VSPLIT] && vs_vsplit(sp, new)) ||
(cmdp->cmd != &cmds[C_VSPLIT] && vs_split(sp, new, 0))) {
(void)screen_end(new);
(void)screen_fini(new);
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ex_tag.c,v 1.9 2013/12/01 02:34:54 christos Exp $ */
/* $NetBSD: ex_tag.c,v 1.10 2013/12/01 21:48:33 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -302,7 +302,7 @@ ex_tag_Nswitch(SCR *sp, TAG *tp, int force)
return (1);
if (vs_split(sp, new, 0)) {
(void)file_end(new, new->ep, 1);
(void)screen_end(new);
(void)screen_fini(new);
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: v_ex.c,v 1.5 2013/12/01 02:34:54 christos Exp $ */
/* $NetBSD: v_ex.c,v 1.6 2013/12/01 21:48:33 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -516,7 +516,7 @@ v_ecl(SCR *sp)
if (screen_init(gp, sp, &new))
return (1);
if (vs_split(sp, new, 1)) {
(void)screen_end(new);
(void)screen_fini(new);
return (1);
}
@ -651,7 +651,7 @@ v_ecl_init(SCR *sp)
return (1);
conv_enc(wp->ccl_sp, O_FILEENCODING, "WCHAR_T");
if (file_init(wp->ccl_sp, frp, NULL, 0)) {
(void)screen_end(wp->ccl_sp);
(void)screen_fini(wp->ccl_sp);
wp->ccl_sp = 0;
return (1);
}