diff options
author | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-07-01 18:01:41 +0000 |
---|---|---|
committer | Vincent Labrecque <vincent@cvs.openbsd.org> | 2002-07-01 18:01:41 +0000 |
commit | 5b599e0094027239ac02006e286e1edf947b8de2 (patch) | |
tree | b6a7f73faf04e7386c6d45dd6ed92ae5154f6e9a /usr.bin/mg | |
parent | 18789ce9742690d8bc5de79bf0308ea2dd65624c (diff) |
just make vtresize return TRUE/FALSE instead of 0/-1, for consistency with
the rest of the mg code. + some KNF.
adapted from diff by zyrnix.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/display.c | 19 | ||||
-rw-r--r-- | usr.bin/mg/tty.c | 6 |
2 files changed, 10 insertions, 15 deletions
diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c index 9e840355ca2..fde9da0f5e3 100644 --- a/usr.bin/mg/display.c +++ b/usr.bin/mg/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.14 2002/06/25 14:24:53 vincent Exp $ */ +/* $OpenBSD: display.c,v 1.15 2002/07/01 18:01:40 vincent Exp $ */ /* * The functions in this file handle redisplay. The @@ -118,9 +118,8 @@ vtresize(int force, int newrow, int newcol) static int first_run = 1; VIDEO *vp; - if (newrow < 1 || newcol < 1) { - return -1; - } + if (newrow < 1 || newcol < 1) + return (FALSE); rowchanged = (newrow != nrow); colchanged = (newcol != ncol); @@ -129,13 +128,13 @@ vtresize(int force, int newrow, int newcol) void *tmp; \ if ((tmp = realloc((a), (n))) == NULL) { \ panic("out of memory in display code"); \ - } \ + } \ (a) = tmp; \ } while (0) /* No update needed */ if (!first_run && !force && !rowchanged && !colchanged) { - return 0; + return (TRUE); } if (first_run) { @@ -173,9 +172,8 @@ vtresize(int force, int newrow, int newcol) /* * Zero-out the entries we just allocated */ - for (i = vidstart; i < 2 * (newrow - 1); i++) { + for (i = vidstart; i < 2 * (newrow - 1); i++) memset(&video[i], 0, sizeof(VIDEO)); - } /* * Reinitialize vscreen and pscreen arrays completely. @@ -189,9 +187,8 @@ vtresize(int force, int newrow, int newcol) } } if (rowchanged || colchanged || first_run) { - for (i = 0; i < 2 * (newrow - 1); i++) { + for (i = 0; i < 2 * (newrow - 1); i++) TRYREALLOC(video[i].v_text, newcol * sizeof(char)); - } TRYREALLOC(blanks.v_text, newcol * sizeof(char)); } @@ -204,7 +201,7 @@ vtresize(int force, int newrow, int newcol) ttcol = ncol; first_run = 0; - return 0; + return (TRUE); } #undef TRYREALLOC diff --git a/usr.bin/mg/tty.c b/usr.bin/mg/tty.c index 9c57bc5816f..fd069bf56be 100644 --- a/usr.bin/mg/tty.c +++ b/usr.bin/mg/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.16 2002/02/21 04:16:23 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.17 2002/07/01 18:01:40 vincent Exp $ */ /* * Terminfo display driver @@ -421,10 +421,8 @@ ttresize() newrow = 24; newcol = 80; } - if (vtresize(1, newrow, newcol)) + if (vtresize(1, newrow, newcol) != TRUE) panic("vtresize failed"); - nrow = newrow; - ncol = newcol; } /* |