From: Kees van Reeuwijk Date: Thu, 21 Jan 2010 22:36:15 +0000 (+0000) Subject: Removed some uses of uninitialized variables in update.c, presumably remnands of... X-Git-Tag: v3.1.6~50 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=c43cdf06f888bfef2445cd71a74d569e66af10c3;p=minix.git Removed some uses of uninitialized variables in update.c, presumably remnands of old color support. Fixed a few cases where free-ed memory blocks were subsequently read. Removed some unused variables, #includes, other small cleanup. --- diff --git a/lib/curses/beep.c b/lib/curses/beep.c index 1fa9a4fff..aa6fced2e 100644 --- a/lib/curses/beep.c +++ b/lib/curses/beep.c @@ -1,5 +1,4 @@ #include -#include "curspriv.h" #include extern char *bl, *vb; diff --git a/lib/curses/charpick.c b/lib/curses/charpick.c index 5c76db4ac..4b464a382 100644 --- a/lib/curses/charpick.c +++ b/lib/curses/charpick.c @@ -1,5 +1,4 @@ #include -#include "curspriv.h" /****************************************************************/ /* Winch(win) returns the character at the current position in */ diff --git a/lib/curses/curs_set.c b/lib/curses/curs_set.c index 3bf5ec153..e481d59b2 100644 --- a/lib/curses/curs_set.c +++ b/lib/curses/curs_set.c @@ -1,5 +1,4 @@ #include -#include "curspriv.h" #include extern char *vi, *ve, *vs; diff --git a/lib/curses/curspriv.h b/lib/curses/curspriv.h index af53d177b..9fd616b0f 100644 --- a/lib/curses/curspriv.h +++ b/lib/curses/curspriv.h @@ -4,7 +4,7 @@ #define _FULLWIN 4 /* window fills screen */ #define _SCROLLWIN 8 /* window lwr rgt is screen lwr rgt */ -#define _NO_CHANGE -1 /* flags line edge unchanged */ +#define _NO_CHANGE (-1) /* flags line edge unchanged */ #define _BREAKCHAR 0x03 /* ^C character */ #define _DCCHAR 0x08 /* Delete Char char (BS) */ #define _DLCHAR 0x1b /* Delete Line char (ESC) */ diff --git a/lib/curses/newwin.c b/lib/curses/newwin.c index 69214707e..23f2471a6 100644 --- a/lib/curses/newwin.c +++ b/lib/curses/newwin.c @@ -27,14 +27,14 @@ int num_lines, num_columns, begy, begx; /* Allocate the minchng and maxchng arrays */ if ((win->_minchng = (int *) calloc(num_lines, sizeof(int))) == NULL) { - free(win); free(win->_line); + free(win); return((WINDOW *) ERR); } if ((win->_maxchng = (int *) calloc(num_lines, sizeof(int))) == NULL) { - free(win); free(win->_line); free(win->_minchng); + free(win); return((WINDOW *) ERR); } diff --git a/lib/curses/options.c b/lib/curses/options.c index 00c888915..2ab0ac3c4 100644 --- a/lib/curses/options.c +++ b/lib/curses/options.c @@ -1,9 +1,6 @@ #include #include "curspriv.h" -static bool hasold = FALSE; /* for remembering old cursor type */ -static int oldmode; - /****************************************************************/ /* Idlok() is used to set flag for using the terminal insert/ */ /* Delete line capabilities. This is not relevant for the PC */ diff --git a/lib/curses/update.c b/lib/curses/update.c index 968ca9836..446326085 100644 --- a/lib/curses/update.c +++ b/lib/curses/update.c @@ -112,13 +112,10 @@ WINDOW *scr; /* Like the corresponding line in _cursvar.tmpwin. */ /****************************************************************/ -static void transformline(lineno) -register int lineno; +static void transformline(register int lineno) { register int *dstp; register int *srcp; - register int dstc; - register int srcc; int x; int endx; @@ -128,9 +125,9 @@ register int lineno; srcp = twin->_line[lineno] + x; while (x <= endx) { - if ((*dstp != *srcp) || (dstc != srcc)) { + if (*dstp != *srcp) { gotoxy(lineno, x); - while (x <= endx && ((*dstp != *srcp) || (dstc != srcc))) { + while (x <= endx && (*dstp != *srcp)) { Putchar(*srcp); *dstp++ = *srcp++; x++;