head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.108 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.106 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.104 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.102 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.100 pkgsrc-2025Q1-base:1.1 pkgsrc-2024Q4:1.1.0.98 pkgsrc-2024Q4-base:1.1 pkgsrc-2024Q3:1.1.0.96 pkgsrc-2024Q3-base:1.1 pkgsrc-2024Q2:1.1.0.94 pkgsrc-2024Q2-base:1.1 pkgsrc-2024Q1:1.1.0.92 pkgsrc-2024Q1-base:1.1 pkgsrc-2023Q4:1.1.0.90 pkgsrc-2023Q4-base:1.1 pkgsrc-2023Q3:1.1.0.88 pkgsrc-2023Q3-base:1.1 pkgsrc-2023Q2:1.1.0.86 pkgsrc-2023Q2-base:1.1 pkgsrc-2023Q1:1.1.0.84 pkgsrc-2023Q1-base:1.1 pkgsrc-2022Q4:1.1.0.82 pkgsrc-2022Q4-base:1.1 pkgsrc-2022Q3:1.1.0.80 pkgsrc-2022Q3-base:1.1 pkgsrc-2022Q2:1.1.0.78 pkgsrc-2022Q2-base:1.1 pkgsrc-2022Q1:1.1.0.76 pkgsrc-2022Q1-base:1.1 pkgsrc-2021Q4:1.1.0.74 pkgsrc-2021Q4-base:1.1 pkgsrc-2021Q3:1.1.0.72 pkgsrc-2021Q3-base:1.1 pkgsrc-2021Q2:1.1.0.70 pkgsrc-2021Q2-base:1.1 pkgsrc-2021Q1:1.1.0.68 pkgsrc-2021Q1-base:1.1 pkgsrc-2020Q4:1.1.0.66 pkgsrc-2020Q4-base:1.1 pkgsrc-2020Q3:1.1.0.64 pkgsrc-2020Q3-base:1.1 pkgsrc-2020Q2:1.1.0.60 pkgsrc-2020Q2-base:1.1 pkgsrc-2020Q1:1.1.0.40 pkgsrc-2020Q1-base:1.1 pkgsrc-2019Q4:1.1.0.62 pkgsrc-2019Q4-base:1.1 pkgsrc-2019Q3:1.1.0.58 pkgsrc-2019Q3-base:1.1 pkgsrc-2019Q2:1.1.0.56 pkgsrc-2019Q2-base:1.1 pkgsrc-2019Q1:1.1.0.54 pkgsrc-2019Q1-base:1.1 pkgsrc-2018Q4:1.1.0.52 pkgsrc-2018Q4-base:1.1 pkgsrc-2018Q3:1.1.0.50 pkgsrc-2018Q3-base:1.1 pkgsrc-2018Q2:1.1.0.48 pkgsrc-2018Q2-base:1.1 pkgsrc-2018Q1:1.1.0.46 pkgsrc-2018Q1-base:1.1 pkgsrc-2017Q4:1.1.0.44 pkgsrc-2017Q4-base:1.1 pkgsrc-2017Q3:1.1.0.42 pkgsrc-2017Q3-base:1.1 pkgsrc-2017Q2:1.1.0.38 pkgsrc-2017Q2-base:1.1 pkgsrc-2017Q1:1.1.0.36 pkgsrc-2017Q1-base:1.1 pkgsrc-2016Q4:1.1.0.34 pkgsrc-2016Q4-base:1.1 pkgsrc-2016Q3:1.1.0.32 pkgsrc-2016Q3-base:1.1 pkgsrc-2016Q2:1.1.0.30 pkgsrc-2016Q2-base:1.1 pkgsrc-2016Q1:1.1.0.28 pkgsrc-2016Q1-base:1.1 pkgsrc-2015Q4:1.1.0.26 pkgsrc-2015Q4-base:1.1 pkgsrc-2015Q3:1.1.0.24 pkgsrc-2015Q3-base:1.1 pkgsrc-2015Q2:1.1.0.22 pkgsrc-2015Q2-base:1.1 pkgsrc-2015Q1:1.1.0.20 pkgsrc-2015Q1-base:1.1 pkgsrc-2014Q4:1.1.0.18 pkgsrc-2014Q4-base:1.1 pkgsrc-2014Q3:1.1.0.16 pkgsrc-2014Q3-base:1.1 pkgsrc-2014Q2:1.1.0.14 pkgsrc-2014Q2-base:1.1 pkgsrc-2014Q1:1.1.0.12 pkgsrc-2014Q1-base:1.1 pkgsrc-2013Q4:1.1.0.10 pkgsrc-2013Q4-base:1.1 pkgsrc-2013Q3:1.1.0.8 pkgsrc-2013Q3-base:1.1 pkgsrc-2013Q2:1.1.0.6 pkgsrc-2013Q2-base:1.1 pkgsrc-2013Q1:1.1.0.4 pkgsrc-2013Q1-base:1.1 pkgsrc-2012Q4:1.1.0.2 pkgsrc-2012Q4-base:1.1; locks; strict; comment @# @; 1.1 date 2012.12.28.03.03.09; author dholland; state Exp; branches; next ; desc @@ 1.1 log @Fix legacy C. Pass -Wall -W -Wmissing-declarations -Wwrite-strings on gcc45. - avoid implicit int, declare void functions void - return values from non-void functions - put most external declarations properly in header files - use some static and const - fix up a big mess with function pointer casting - use standard includes, don't provide own decls of standard functions - use types matching libc when providing own malloc, printf, and putchar - use functions correctly - silence assorted compiler warnings - fix some bugs exposed by compiler warnings - don't intentionally exercise signed overflow - remove some unused items - add patch comments to other patch (patch-aa) As this includes several fixes and removes some undefined behavior on a commonly reachable code path, bump PKGREVISION. @ text @$NetBSD$ - declare local functions static - declare void functions void - avoid implicit int - silence warnings about braces - silence warnings about && and || precedence --- ex_vadj.c~ 2012-12-27 21:58:42.000000000 +0000 +++ ex_vadj.c @@@@ -90,12 +90,12 @@@@ static char sccsid[] = "@@(#)ex_vadj.c 1. * screen cleanup after a change. */ -int vdellin __P((int, int, int)); -int vscroll __P((register int)); -int vadjAL __P((int, int)); -int vcloseup __P((int, register int)); -int vopenup __P((int, int, int)); -int vadjDL __P((int, int)); +static void vdellin __P((int, int, int)); +static void vscroll __P((register int)); +static void vadjAL __P((int, int)); +static void vcloseup __P((int, register int)); +static void vopenup __P((int, int, int)); +static void vadjDL __P((int, int)); /* * Display a new line at physical line p, returning @@@@ -106,6 +106,7 @@@@ int vadjDL __P((int, int)); * on the screen in which case the line may actually end up * somewhere other than line p. */ +void vopen(tp, p) line *tp; int p; @@@@ -118,11 +119,12 @@@@ vopen(tp, p) tfixnl(), fprintf(trace, "vopen(%d, %d)\n", lineno(tp), p); #endif if (state != VISUAL) { - if (vcnt) + if (vcnt) { if (hold & HOLDROL) vup1(); else vclean(); + } /* * Forget all that we once knew. @@@@ -169,6 +171,7 @@@@ vopen(tp, p) /* * Redisplay logical line l at physical line p with line number lineno. */ +int vreopen(p, lineno, l) int p, lineno, l; { @@@@ -256,6 +259,7 @@@@ vreopen(p, lineno, l) * delete some (blank) lines from the top of the screen so that * later inserts will not push stuff off the bottom. */ +int vglitchup(l, o) int l, o; { @@@@ -297,6 +301,7 @@@@ vglitchup(l, o) * Insert cnt blank lines before line p, * logically and (if supported) physically. */ +void vinslin(p, cnt, l) register int p, cnt; int l; @@@@ -378,9 +383,11 @@@@ vinslin(p, cnt, l) * it ourselves (brute force) we will squish out @@ lines in the process * if this will save us work. */ +static void vopenup(cnt, could, l) int cnt; bool could; + int l; { register struct vlinfo *vc = &vlinfo[l + 1]; register struct vlinfo *ve = &vlinfo[vcnt]; @@@@ -423,6 +430,7 @@@@ vopenup(cnt, could, l) * Adjust data structure internally to account for insertion of * blank lines on the screen. */ +static void vadjAL(p, cnt) int p, cnt; { @@@@ -451,6 +459,7 @@@@ vadjAL(p, cnt) * Roll the screen up logically and physically * so that line dl is the bottom line on the screen. */ +void vrollup(dl) int dl; { @@@@ -469,6 +478,7 @@@@ vrollup(dl) destline = dl - cnt, destcol = dc; } +void vup1() { @@@@ -480,6 +490,7 @@@@ vup1() * If doclr is true, do a clear eol if the terminal * has standout (to prevent it from scrolling up) */ +void vmoveitup(cnt, doclr) register int cnt; bool doclr; @@@@ -513,6 +524,7 @@@@ vmoveitup(cnt, doclr) /* * Scroll the screen up cnt lines logically. */ +static void vscroll(cnt) register int cnt; { @@@@ -541,6 +553,7 @@@@ vscroll(cnt) /* * Discard logical lines due to physical wandering off the screen. */ +void vscrap() { register int i, j; @@@@ -591,6 +604,7 @@@@ vscrap() * Repaint the screen, with cursor at curs, aftern an arbitrary change. * Handle notification on large changes. */ +void vrepaint(curs) char *curs; { @@@@ -605,15 +619,16 @@@@ vrepaint(curs) /* * Deal with a totally useless display. */ - if (vcnt == 0 || vcline < 0 || vcline > vcnt || holdupd && state != VISUAL) { + if (vcnt == 0 || vcline < 0 || vcline > vcnt || (holdupd && state != VISUAL)) { register line *odol = dol; vcnt = 0; - if (holdupd) + if (holdupd) { if (state == VISUAL) ignore(peekkey()); else vup1(); + } holdupd = 0; if (odol == zero) fixzero(); @@@@ -682,6 +697,7 @@@@ vrepaint(curs) * line after last won't completely fit. The routine vsync is * more conservative and much less work on dumb terminals. */ +void vredraw(p) register int p; { @@@@ -803,6 +819,7 @@@@ vredraw(p) * Do the real work in deleting cnt lines starting at line p from * the display. First affected line is line l. */ +static void vdellin(p, cnt, l) int p, cnt, l; { @@@@ -849,6 +866,7 @@@@ vdellin(p, cnt, l) /* * Adjust internal physical screen image to account for deleted lines. */ +static void vadjDL(p, cnt) int p, cnt; { @@@@ -878,12 +896,14 @@@@ vadjDL(p, cnt) * In any case, if the redraw option is set then all syncs map to redraws * as if vsync didn't exist. */ +void vsyncCL() { vsync(LINE(vcline)); } +void vsync(p) register int p; { @@@@ -898,6 +918,7 @@@@ vsync(p) * The guts of a sync. Similar to redraw but * just less ambitous. */ +void vsync1(p) register int p; { @@@@ -933,7 +954,7 @@@@ vsync1(p) * the current line, or if this line is piled under the * next line (vreplace does this and we undo it). */ - if (l == 0 && state != VISUAL || + if ((l == 0 && state != VISUAL) || (l < vcnt && (vp->vliny <= p || vp[0].vliny == vp[1].vliny))) { if (l == 0 || vp->vliny < p || (vp->vflags & VDIRT)) { if (l == vcline) @@@@ -972,6 +993,7 @@@@ vsync1(p) * Subtract (logically) cnt physical lines from the * displayed position of lines starting with line l. */ +static void vcloseup(l, cnt) int l; register int cnt; @@@@ -996,6 +1018,7 @@@@ vcloseup(l, cnt) * * Many boundary conditions here. */ +void vreplace(l, cnt, newcnt) int l, cnt, newcnt; { @@@@ -1054,7 +1077,7 @@@@ vreplace(l, cnt, newcnt) * over them, since otherwise we will push them * slowly off the screen, a clear lose. */ - if (cnt == newcnt || vcnt - l == newcnt && AL && DL) { + if (cnt == newcnt || (vcnt - l == newcnt && AL && DL)) { if (cnt > 1 && l + cnt > vcnt) savenote++; vdirty(l, newcnt); @@@@ -1135,6 +1158,7 @@@@ skip: * If we are in a scroll ^D within hardcopy open then all this * is suppressed. */ +void sethard() { @@@@ -1155,6 +1179,7 @@@@ sethard() * as dirty so that they will be checked for correct * display at next sync/redraw. */ +void vdirty(base, i) register int base, i; { @