From 68f0edd643ce7ba5970574838c8185cdbc9d54aa Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sun, 5 Nov 2006 07:13:40 +0000 Subject: [PATCH] Similar changes for 0 as for NULL. --- pdcurses/addch.c | 10 +++++----- pdcurses/border.c | 8 ++++---- pdcurses/getch.c | 6 +++--- pdcurses/inopts.c | 4 ++-- pdcurses/insstr.c | 4 ++-- pdcurses/kernel.c | 4 ++-- pdcurses/scanw.c | 32 ++++++++++++++++---------------- pdcurses/util.c | 6 +++--- pdcurses/window.c | 6 +++--- 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/pdcurses/addch.c b/pdcurses/addch.c index 0fce5c20..e4348e62 100644 --- a/pdcurses/addch.c +++ b/pdcurses/addch.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: addch.c,v 1.34 2006/11/05 03:57:26 wmcbrine Exp $"); +RCSID("$Id: addch.c,v 1.35 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -172,10 +172,10 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) component, use the attributes solely from the incoming character. */ - if ((ch & A_ATTRIBUTES) == 0) + if (!(ch & A_ATTRIBUTES)) attr = win->_attrs; else - if ((ch & A_COLOR) == 0) + if (!(ch & A_COLOR)) attr = (ch & A_ATTRIBUTES) | win->_attrs; else attr = ch & A_ATTRIBUTES; @@ -187,7 +187,7 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) attributes are not there and that the background character will only print if the printing character is blank. */ - if ((attr & A_COLOR) == 0) + if (!(attr & A_COLOR)) attr |= win->_bkgd & A_ATTRIBUTES; else { @@ -213,7 +213,7 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) /* if tab to next line, exit the loop */ - if (win->_curx == 0) + if (!win->_curx) break; } PDC_sync(win); diff --git a/pdcurses/border.c b/pdcurses/border.c index f85658da..2173c7dc 100644 --- a/pdcurses/border.c +++ b/pdcurses/border.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: border.c,v 1.42 2006/11/05 04:23:36 wmcbrine Exp $"); +RCSID("$Id: border.c,v 1.43 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -121,10 +121,10 @@ static chtype _attr_passthru(WINDOW *win, chtype ch) the window. If the incoming character has a color component, use only the attributes from the incoming character. */ - if ((ch & A_ATTRIBUTES) == 0) + if (!(ch & A_ATTRIBUTES)) attr = win->_attrs; else - if ((ch & A_COLOR) == 0) + if (!(ch & A_COLOR)) attr = (ch & A_ATTRIBUTES) | win->_attrs; else attr = ch & A_ATTRIBUTES; @@ -133,7 +133,7 @@ static chtype _attr_passthru(WINDOW *win, chtype ch) background, in that it only takes precedence if other color attributes are not there. */ - if ((attr & A_COLOR) == 0) + if (!(attr & A_COLOR)) attr |= win->_bkgd & A_ATTRIBUTES; else { diff --git a/pdcurses/getch.c b/pdcurses/getch.c index 48eb1b27..b0f5510b 100644 --- a/pdcurses/getch.c +++ b/pdcurses/getch.c @@ -16,7 +16,7 @@ #define _INBUFSIZ 512 /* size of terminal input buffer */ #define NUNGETCH 256 /* max # chars to ungetch() */ -RCSID("$Id: getch.c,v 1.50 2006/11/05 03:57:26 wmcbrine Exp $"); +RCSID("$Id: getch.c,v 1.51 2006/11/05 07:13:40 wmcbrine Exp $"); static int c_pindex = 0; /* putter index */ static int c_gindex = 1; /* getter index */ @@ -134,7 +134,7 @@ int wgetch(WINDOW *win) delay in 1/20ths of a second (50ms) */ waitcount = win->_delayms / 50; - if (waitcount == 0) + if (!waitcount) waitcount = 1; } @@ -184,7 +184,7 @@ int wgetch(WINDOW *win) { if (SP->delaytenths || win->_delayms) { - if (waitcount == 0) + if (!waitcount) return ERR; waitcount--; diff --git a/pdcurses/inopts.c b/pdcurses/inopts.c index 87f9c47d..e95c28ff 100644 --- a/pdcurses/inopts.c +++ b/pdcurses/inopts.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: inopts.c,v 1.33 2006/11/05 03:57:26 wmcbrine Exp $"); +RCSID("$Id: inopts.c,v 1.34 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -329,7 +329,7 @@ void wtimeout(WINDOW *win, int delay) win->_nodelay = FALSE; win->_delayms = 0; } - else if (delay == 0) + else if (!delay) { /* This causes a non-blocking read on the window so turn off delay mode */ diff --git a/pdcurses/insstr.c b/pdcurses/insstr.c index 24eb07be..6da737d7 100644 --- a/pdcurses/insstr.c +++ b/pdcurses/insstr.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: insstr.c,v 1.35 2006/11/05 03:57:26 wmcbrine Exp $"); +RCSID("$Id: insstr.c,v 1.36 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -170,7 +170,7 @@ int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) if (!win || !wstr) return ERR; - for (ic = 0, p = wstr; *p != L'\0'; p++) + for (ic = 0, p = wstr; *p; p++) ic++; if (n > 0) diff --git a/pdcurses/kernel.c b/pdcurses/kernel.c index b78cb426..9ac33ddf 100644 --- a/pdcurses/kernel.c +++ b/pdcurses/kernel.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: kernel.c,v 1.65 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: kernel.c,v 1.66 2006/11/05 07:13:40 wmcbrine Exp $"); RIPPEDOFFLINE linesripped[5]; char linesrippedoff = 0; @@ -246,7 +246,7 @@ int ripoffline(int line, int (*init)(WINDOW *, int)) { PDC_LOG(("ripoffline() - called: line=%d\n", line)); - if (linesrippedoff < 5 && line != 0) + if (linesrippedoff < 5 && line) { linesripped[(int)linesrippedoff].line = line; linesripped[(int)linesrippedoff++].init = init; diff --git a/pdcurses/scanw.c b/pdcurses/scanw.c index 530fe85c..7b92d876 100644 --- a/pdcurses/scanw.c +++ b/pdcurses/scanw.c @@ -27,7 +27,7 @@ static int _pdc_vsscanf(const char *, const char *, va_list); # define vsscanf _pdc_vsscanf #endif -RCSID("$Id: scanw.c,v 1.32 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: scanw.c,v 1.33 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -172,8 +172,8 @@ int vw_scanw(WINDOW *win, const char *fmt, va_list varglist) #define NEXT(x) \ do { \ x = *buf++; \ - if (x == '\0') \ - return (count == 0 ? EOF : count); \ + if (!x) \ + return (count ? count : EOF); \ ++chars; \ } while (0) @@ -214,9 +214,9 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) do { c = *buf++; - if (c == '\0') + if (!c) { - if (f == 0 || count != 0) + if (!f || count) return count; else return EOF; @@ -247,7 +247,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) width = 0; while (isdigit(*fmt)) width = width * 10 + (*fmt++ - '0'); - if (width == 0) + if (!width) width = INT_MAX; } size = 0; @@ -300,7 +300,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) } /* no break */ default: - if (fmt[1] == '-' && fmt[2] != 0 + if (fmt[1] == '-' && fmt[2] && f < (unsigned char) fmt[2]) { @@ -337,7 +337,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) if (assign) *char_ptr++ = (char) c; c = *buf++; - if (c == '\0') + if (!c) break; else ++chars; @@ -347,7 +347,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) *char_ptr = 0; ++count; } - if (c == '\0') + if (!c) return count; else UNGETC(); @@ -380,7 +380,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) dx = dx * 10.0 + (double) (c - '0'); ok = TRUE; c = *buf++; - if (c == '\0') + if (!c) break; else ++chars; @@ -397,7 +397,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) dd *= 10.0; ok = TRUE; c = *buf++; - if (c == '\0') + if (!c) break; else ++chars; @@ -431,7 +431,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) --width; exp = exp * 10 + (c - '0'); c = *buf++; - if (c == '\0') + if (!c) break; else ++chars; @@ -466,7 +466,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) } ++count; } - if (c == '\0') + if (!c) return count; else UNGETC(); @@ -545,7 +545,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) ok = TRUE; n = n * radix + d; c = *buf++; - if (c == '\0') + if (!c) break; else ++chars; @@ -575,7 +575,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) } ++count; } - if (c == '\0') + if (!c) return count; else UNGETC(); @@ -589,7 +589,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr) } break; default: - if (f == 0) /* % at end of string */ + if (!f) /* % at end of string */ return count; NEXT(c); if (c != f) diff --git a/pdcurses/util.c b/pdcurses/util.c index 94ba2596..3f6999ab 100644 --- a/pdcurses/util.c +++ b/pdcurses/util.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: util.c,v 1.54 2006/10/23 05:55:01 wmcbrine Exp $"); +RCSID("$Id: util.c,v 1.55 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -225,7 +225,7 @@ int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, *attrs = (*wcval & (A_ATTRIBUTES & ~A_COLOR)); *color_pair = PAIR_NUMBER(*wcval & A_COLOR); - if (*wch != L'\0') + if (*wch) *++wch = L'\0'; return OK; @@ -258,7 +258,7 @@ wchar_t *wunctrl(cchar_t *wc) if (ic >= 0x20 && ic != 0x7f) /* normal characters */ { strbuf[0] = (wchar_t)ic; - strbuf[1] = '\0'; + strbuf[1] = L'\0'; return strbuf; } diff --git a/pdcurses/window.c b/pdcurses/window.c index 0143a62d..41b269b1 100644 --- a/pdcurses/window.c +++ b/pdcurses/window.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: window.c,v 1.44 2006/11/05 03:57:26 wmcbrine Exp $"); +RCSID("$Id: window.c,v 1.45 2006/11/05 07:13:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -215,9 +215,9 @@ WINDOW *newwin(int nlines, int ncols, int begy, int begx) PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n", nlines, ncols, begy, begx)); - if (nlines == 0) + if (!nlines) nlines = LINES - begy; - if (ncols == 0) + if (!ncols) ncols = COLS - begx; if (begy + nlines > SP->lines || begx + ncols > SP->cols)