Module Name: src Committed By: christos Date: Sun Dec 1 21:48:33 UTC 2013
Modified Files: src/external/bsd/nvi/dist/common: screen.c src/external/bsd/nvi/dist/ex: ex_args.c ex_edit.c ex_tag.c src/external/bsd/nvi/dist/vi: v_ex.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/common/screen.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/nvi/dist/ex/ex_args.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/ex/ex_edit.c cvs rdiff -u -r1.9 -r1.10 src/external/bsd/nvi/dist/ex/ex_tag.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/vi/v_ex.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/screen.c diff -u src/external/bsd/nvi/dist/common/screen.c:1.5 src/external/bsd/nvi/dist/common/screen.c:1.6 --- src/external/bsd/nvi/dist/common/screen.c:1.5 Sat Nov 30 21:34:54 2013 +++ src/external/bsd/nvi/dist/common/screen.c Sun Dec 1 16:48:33 2013 @@ -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); } @@ -197,9 +197,20 @@ screen_end1(SCR *sp, int init) } /* + * 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. Index: src/external/bsd/nvi/dist/ex/ex_args.c diff -u src/external/bsd/nvi/dist/ex/ex_args.c:1.2 src/external/bsd/nvi/dist/ex/ex_args.c:1.3 --- src/external/bsd/nvi/dist/ex/ex_args.c:1.2 Fri Nov 22 10:52:05 2013 +++ src/external/bsd/nvi/dist/ex/ex_args.c Sun Dec 1 16:48:33 2013 @@ -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); } Index: src/external/bsd/nvi/dist/ex/ex_edit.c diff -u src/external/bsd/nvi/dist/ex/ex_edit.c:1.5 src/external/bsd/nvi/dist/ex/ex_edit.c:1.6 --- src/external/bsd/nvi/dist/ex/ex_edit.c:1.5 Sat Nov 30 21:34:54 2013 +++ src/external/bsd/nvi/dist/ex/ex_edit.c Sun Dec 1 16:48:33 2013 @@ -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 *fr 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); } Index: src/external/bsd/nvi/dist/ex/ex_tag.c diff -u src/external/bsd/nvi/dist/ex/ex_tag.c:1.9 src/external/bsd/nvi/dist/ex/ex_tag.c:1.10 --- src/external/bsd/nvi/dist/ex/ex_tag.c:1.9 Sat Nov 30 21:34:54 2013 +++ src/external/bsd/nvi/dist/ex/ex_tag.c Sun Dec 1 16:48:33 2013 @@ -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 for 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); } Index: src/external/bsd/nvi/dist/vi/v_ex.c diff -u src/external/bsd/nvi/dist/vi/v_ex.c:1.5 src/external/bsd/nvi/dist/vi/v_ex.c:1.6 --- src/external/bsd/nvi/dist/vi/v_ex.c:1.5 Sat Nov 30 21:34:54 2013 +++ src/external/bsd/nvi/dist/vi/v_ex.c Sun Dec 1 16:48:33 2013 @@ -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); }