diff --git a/pdcurses/addch.c b/pdcurses/addch.c index 74c64b45..0fce5c20 100644 --- a/pdcurses/addch.c +++ b/pdcurses/addch.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: addch.c,v 1.33 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: addch.c,v 1.34 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -128,7 +128,7 @@ RCSID("$Id: addch.c,v 1.33 2006/11/04 12:59:03 wmcbrine Exp $"); static int _newline(WINDOW *win, int lin) { - if (win == (WINDOW *)NULL) + if (!win) return -1; if (++lin > win->_bmarg) @@ -154,7 +154,7 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) "(char=%c attr=0x%x) advance=%d\n", win, ch, ch & A_CHARTEXT, ch & A_ATTRIBUTES, advance)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; x = win->_curx; diff --git a/pdcurses/addstr.c b/pdcurses/addstr.c index a2e17b6f..7bb79dad 100644 --- a/pdcurses/addstr.c +++ b/pdcurses/addstr.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: addstr.c,v 1.33 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: addstr.c,v 1.34 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -75,7 +75,7 @@ int waddnstr(WINDOW *win, const char *str, int n) PDC_LOG(("waddnstr() - called: string=\"%s\" n %d \n", str, n)); - if (win == (WINDOW *)NULL || str == (const char *)NULL) + if (!win || !str) return ERR; for (ic = 0; *str && (ic < n || n < 0); ic++) @@ -158,7 +158,7 @@ int waddnwstr(WINDOW *win, const wchar_t *wstr, int n) PDC_LOG(("waddnwstr() - called\n")); - if (win == (WINDOW *)NULL || wstr == (const wchar_t *)NULL) + if (!win || !wstr) return ERR; for (ic = 0; *wstr && (ic < n || n < 0); ic++) diff --git a/pdcurses/attr.c b/pdcurses/attr.c index 22ffc709..136797b6 100644 --- a/pdcurses/attr.c +++ b/pdcurses/attr.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: attr.c,v 1.32 2006/11/05 02:40:26 wmcbrine Exp $"); +RCSID("$Id: attr.c,v 1.33 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -125,7 +125,7 @@ int wattroff(WINDOW *win, chtype attrs) { PDC_LOG(("wattroff() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_attrs &= (~attrs & A_ATTRIBUTES); @@ -147,7 +147,7 @@ int wattron(WINDOW *win, chtype attrs) PDC_LOG(("wattron() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; if ((win->_attrs & A_COLOR) && (attrs & A_COLOR)) @@ -176,7 +176,7 @@ int wattrset(WINDOW *win, chtype attrs) { PDC_LOG(("wattrset() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_attrs = attrs & A_ATTRIBUTES; @@ -228,7 +228,7 @@ int wcolor_set(WINDOW *win, short color_pair, void *opts) { PDC_LOG(("wcolor_set() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_attrs = (win->_attrs & ~A_COLOR) | COLOR_PAIR(color_pair); @@ -247,13 +247,13 @@ int wattr_get(WINDOW *win, attr_t *attrs, short *color_pair, void *opts) { PDC_LOG(("wattr_get() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; - if (attrs != (attr_t *)NULL) + if (attrs) *attrs = win->_attrs & (A_ATTRIBUTES & ~A_COLOR); - if (color_pair != (short *)NULL) + if (color_pair) *color_pair = PAIR_NUMBER(win->_attrs); return OK; @@ -298,7 +298,7 @@ int wattr_set(WINDOW *win, attr_t attrs, short color_pair, void *opts) { PDC_LOG(("wattr_set() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_attrs = (attrs & (A_ATTRIBUTES & ~A_COLOR)) | @@ -321,7 +321,7 @@ int wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts) PDC_LOG(("wchgat() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; newattr = (attr & A_ATTRIBUTES) | COLOR_PAIR(color); diff --git a/pdcurses/bkgd.c b/pdcurses/bkgd.c index 8988e2e4..15cd8909 100644 --- a/pdcurses/bkgd.c +++ b/pdcurses/bkgd.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: bkgd.c,v 1.30 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: bkgd.c,v 1.31 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -92,7 +92,7 @@ int wbkgd(WINDOW *win, chtype ch) PDC_LOG(("wbkgd() - called\n")); - if (win == NULL) + if (!win) return ERR; if (win->_bkgd == ch) @@ -175,7 +175,7 @@ void wbkgdset(WINDOW *win, chtype ch) PDC_LOG(("wbkgdset() - called\n")); - if (win == NULL) + if (!win) return; if (win->_bkgd == ch) diff --git a/pdcurses/border.c b/pdcurses/border.c index 621897d8..2456e34b 100644 --- a/pdcurses/border.c +++ b/pdcurses/border.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: border.c,v 1.40 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: border.c,v 1.41 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -153,7 +153,7 @@ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, PDC_LOG(("wborder() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; ymax = win->_maxy - 1; @@ -217,7 +217,7 @@ int whline(WINDOW *win, chtype ch, int n) PDC_LOG(("whline() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; if (n < 1) @@ -283,7 +283,7 @@ int wvline(WINDOW *win, chtype ch, int n) PDC_LOG(("wvline() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; if (n < 1) diff --git a/pdcurses/clear.c b/pdcurses/clear.c index 0e3ccc3a..fba2d32e 100644 --- a/pdcurses/clear.c +++ b/pdcurses/clear.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: clear.c,v 1.26 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: clear.c,v 1.27 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -70,7 +70,7 @@ int wclrtoeol(WINDOW *win) PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n", win->_cury, win->_curx)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; y = win->_cury; @@ -105,7 +105,7 @@ int wclrtobot(WINDOW *win) PDC_LOG(("wclrtobot() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; /* should this involve scrolling region somehow ? */ @@ -153,7 +153,7 @@ int wclear(WINDOW *win) { PDC_LOG(("wclear() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_clear = TRUE; diff --git a/pdcurses/delch.c b/pdcurses/delch.c index 76998077..d59c63b2 100644 --- a/pdcurses/delch.c +++ b/pdcurses/delch.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: delch.c,v 1.25 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: delch.c,v 1.26 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -51,7 +51,7 @@ int wdelch(WINDOW *win) PDC_LOG(("wdelch() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; y = win->_cury; diff --git a/pdcurses/deleteln.c b/pdcurses/deleteln.c index 7c63a3d4..8565c2e7 100644 --- a/pdcurses/deleteln.c +++ b/pdcurses/deleteln.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: deleteln.c,v 1.25 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: deleteln.c,v 1.26 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -58,7 +58,7 @@ int wdeleteln(WINDOW *win) PDC_LOG(("wdeleteln() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; /* wrs (4/10/93) account for window background */ @@ -100,7 +100,7 @@ int winsdelln(WINDOW *win, int n) PDC_LOG(("winsdelln() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; if (n > 0) @@ -134,7 +134,7 @@ int winsertln(WINDOW *win) PDC_LOG(("winsertln() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; /* wrs (4/10/93) account for window background */ diff --git a/pdcurses/getch.c b/pdcurses/getch.c index 2f9111ab..48eb1b27 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.49 2006/10/29 12:05:13 wmcbrine Exp $"); +RCSID("$Id: getch.c,v 1.50 2006/11/05 03:57:26 wmcbrine Exp $"); static int c_pindex = 0; /* putter index */ static int c_gindex = 1; /* getter index */ @@ -118,7 +118,7 @@ int wgetch(WINDOW *win) PDC_LOG(("wgetch() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; waitcount = 0; diff --git a/pdcurses/getstr.c b/pdcurses/getstr.c index f0db6c25..36009a32 100644 --- a/pdcurses/getstr.c +++ b/pdcurses/getstr.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: getstr.c,v 1.38 2006/11/03 14:06:02 wmcbrine Exp $"); +RCSID("$Id: getstr.c,v 1.39 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -90,7 +90,7 @@ int wgetnstr(WINDOW *win, char *str, int n) PDC_LOG(("wgetnstr() - called\n")); - if (win == (WINDOW *)NULL || str == (char *)NULL) + if (!win || !str) return ERR; chars = 0; @@ -284,7 +284,7 @@ int wgetn_wstr(WINDOW *win, wint_t *wstr, int n) PDC_LOG(("wgetn_wstr() - called\n")); - if (win == (WINDOW *)NULL || wstr == (wint_t *)NULL) + if (!win || !wstr) return ERR; chars = 0; diff --git a/pdcurses/getyx.c b/pdcurses/getyx.c index 8c2e5cc9..cf8e6c6e 100644 --- a/pdcurses/getyx.c +++ b/pdcurses/getyx.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: getyx.c,v 1.20 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: getyx.c,v 1.21 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -71,78 +71,54 @@ int getbegy(WINDOW *win) { PDC_LOG(("getbegy() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_begy; + return win ? win->_begy : ERR; } int getbegx(WINDOW *win) { PDC_LOG(("getbegx() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_begx; + return win ? win->_begx : ERR; } int getcury(WINDOW *win) { PDC_LOG(("getcury() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_cury; + return win ? win->_cury : ERR; } int getcurx(WINDOW *win) { PDC_LOG(("getcurx() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_curx; + return win ? win->_curx : ERR; } int getpary(WINDOW *win) { PDC_LOG(("getpary() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_pary; + return win ? win->_pary : ERR; } int getparx(WINDOW *win) { PDC_LOG(("getparx() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_parx; + return win ? win->_parx : ERR; } int getmaxy(WINDOW *win) { PDC_LOG(("getmaxy() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_maxy; + return win ? win->_maxy : ERR; } int getmaxx(WINDOW *win) { PDC_LOG(("getmaxx() - called\n")); - if (win == (WINDOW *)NULL) - return ERR; - - return win->_maxx; + return win ? win->_maxx : ERR; } diff --git a/pdcurses/inch.c b/pdcurses/inch.c index 13dffb87..63653520 100644 --- a/pdcurses/inch.c +++ b/pdcurses/inch.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: inch.c,v 1.26 2006/10/23 05:46:32 wmcbrine Exp $"); +RCSID("$Id: inch.c,v 1.27 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -53,7 +53,7 @@ chtype winch(WINDOW *win) { PDC_LOG(("winch() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return (chtype)ERR; return win->_y[win->_cury][win->_curx]; diff --git a/pdcurses/inchstr.c b/pdcurses/inchstr.c index 57af7fdd..1ef60b96 100644 --- a/pdcurses/inchstr.c +++ b/pdcurses/inchstr.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: inchstr.c,v 1.26 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: inchstr.c,v 1.27 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index 4ea0d47d..68e33d4c 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: initscr.c,v 1.85 2006/11/01 16:12:35 wmcbrine Exp $"); +RCSID("$Id: initscr.c,v 1.86 2006/11/05 03:57:26 wmcbrine Exp $"); const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006"; @@ -129,7 +129,7 @@ WINDOW *Xinitscr(int argc, char *argv[]) PDC_LOG(("Xinitscr() - called\n")); - if (SP != (SCREEN *)NULL && SP->alive) + if (SP && SP->alive) return NULL; if (PDC_scr_open(argc, argv) == ERR) @@ -303,7 +303,7 @@ int resize_term(int nlines, int ncols) { PDC_LOG(("resize_term() - called: nlines %d\n", nlines)); - if (stdscr == (WINDOW *)NULL) + if (!stdscr) return ERR; if (PDC_resize_screen(nlines, ncols) == ERR) diff --git a/pdcurses/inopts.c b/pdcurses/inopts.c index 02fcf468..87f9c47d 100644 --- a/pdcurses/inopts.c +++ b/pdcurses/inopts.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: inopts.c,v 1.32 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: inopts.c,v 1.33 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -221,7 +221,7 @@ int keypad(WINDOW *win, bool bf) { PDC_LOG(("keypad() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_use_keypad = bf; @@ -260,7 +260,7 @@ int nodelay(WINDOW *win, bool flag) { PDC_LOG(("nodelay() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_nodelay = flag; @@ -318,7 +318,7 @@ void wtimeout(WINDOW *win, int delay) { PDC_LOG(("wtimeout() - called\n")); - if (win == NULL) + if (!win) return; if (delay < 0) diff --git a/pdcurses/insch.c b/pdcurses/insch.c index da500b30..c59cf9c3 100644 --- a/pdcurses/insch.c +++ b/pdcurses/insch.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: insch.c,v 1.32 2006/11/03 14:08:10 wmcbrine Exp $"); +RCSID("$Id: insch.c,v 1.33 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -105,7 +105,7 @@ int winsch(WINDOW *win, chtype ch) PDC_LOG(("winsch() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; xlat = !(SP->raw_out) && !(ch & A_ALTCHARSET); diff --git a/pdcurses/insstr.c b/pdcurses/insstr.c index 959f8a43..24eb07be 100644 --- a/pdcurses/insstr.c +++ b/pdcurses/insstr.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: insstr.c,v 1.34 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: insstr.c,v 1.35 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -78,7 +78,7 @@ int winsnstr(WINDOW *win, const char *str, int n) PDC_LOG(("winsnstr() - called: string=\"%s\" n %d \n", str, n)); - if (win == (WINDOW *)NULL || str == (const char *)NULL) + if (!win || !str) return ERR; ic = strlen(str); @@ -167,7 +167,7 @@ int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) PDC_LOG(("wins_nwstr() - called\n")); - if (win == (WINDOW *)NULL || wstr == (const wchar_t *)NULL) + if (!win || !wstr) return ERR; for (ic = 0, p = wstr; *p != L'\0'; p++) diff --git a/pdcurses/instr.c b/pdcurses/instr.c index 4ee7bcd6..a01bc782 100644 --- a/pdcurses/instr.c +++ b/pdcurses/instr.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: instr.c,v 1.31 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: instr.c,v 1.32 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -78,7 +78,7 @@ int winnstr(WINDOW *win, char *str, int n) PDC_LOG(("winnstr() - called: n %d \n", n)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; oldy = win->_cury; @@ -177,7 +177,7 @@ int winnwstr(WINDOW *win, wchar_t *wstr, int n) PDC_LOG(("winnstr() - called: n %d \n", n)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; oldy = win->_cury; diff --git a/pdcurses/mouse.c b/pdcurses/mouse.c index 8016f527..749ad2de 100644 --- a/pdcurses/mouse.c +++ b/pdcurses/mouse.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: mouse.c,v 1.26 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: mouse.c,v 1.27 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -133,7 +133,7 @@ void wmouse_position(WINDOW *win, int *y, int *x) /* if the current mouse position is outside the provided window, put -1 in x and y */ - if (win == (WINDOW *)NULL) + if (!win) { *y = *x = -1; return; diff --git a/pdcurses/move.c b/pdcurses/move.c index 83b0aaea..686afb12 100644 --- a/pdcurses/move.c +++ b/pdcurses/move.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: move.c,v 1.20 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: move.c,v 1.21 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -42,10 +42,8 @@ int move(int y, int x) { PDC_LOG(("move() - called: y=%d x=%d\n", y, x)); - if (stdscr == (WINDOW *)NULL) - return ERR; - - if ((x < 0) || (y < 0) || (x >= stdscr->_maxx) || (y >= stdscr->_maxy)) + if (!stdscr + || x < 0 || y < 0 || x >= stdscr->_maxx || y >= stdscr->_maxy) return ERR; stdscr->_curx = x; @@ -58,10 +56,8 @@ int wmove(WINDOW *win, int y, int x) { PDC_LOG(("wmove() - called: y=%d x=%d\n", y, x)); - if (win == (WINDOW *)NULL) - return ERR; - - if ((x < 0) || (y < 0) || (x >= win->_maxx) || (y >= win->_maxy)) + if (!win + || x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy) return ERR; win->_curx = x; diff --git a/pdcurses/outopts.c b/pdcurses/outopts.c index 2307b02e..9b98c6d6 100644 --- a/pdcurses/outopts.c +++ b/pdcurses/outopts.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: outopts.c,v 1.29 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: outopts.c,v 1.30 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -107,7 +107,7 @@ int clearok(WINDOW *win, bool bf) { PDC_LOG(("clearok() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_clear = bf; @@ -131,7 +131,7 @@ void immedok(WINDOW *win, bool bf) { PDC_LOG(("immedok() - called\n")); - if (win != (WINDOW *)NULL) + if (win) win->_immed = bf; } @@ -139,7 +139,7 @@ int leaveok(WINDOW *win, bool bf) { PDC_LOG(("leaveok() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_leaveit = bf; @@ -160,7 +160,7 @@ int wsetscrreg(WINDOW *win, int top, int bottom) { PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; if ((0 <= top) && (top <= win->_cury) && @@ -179,7 +179,7 @@ int scrollok(WINDOW *win, bool bf) { PDC_LOG(("scrollok() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_scroll = bf; diff --git a/pdcurses/overlay.c b/pdcurses/overlay.c index 31c31dc6..09849b12 100644 --- a/pdcurses/overlay.c +++ b/pdcurses/overlay.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: overlay.c,v 1.25 2006/10/23 05:03:31 wmcbrine Exp $"); +RCSID("$Id: overlay.c,v 1.26 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -81,7 +81,7 @@ static int _copy_win(const WINDOW *src_w, WINDOW *dst_w, int src_tr, int xdiff = src_bc - src_tc; int ydiff = src_br - src_tr; - if ((src_w == (WINDOW *)NULL) || (dst_w == (WINDOW *)NULL)) + if (!src_w || !dst_w) return ERR; minchng = dst_w->_firstch; @@ -145,7 +145,7 @@ int overlay(const WINDOW *src_w, WINDOW *dst_w) PDC_LOG(("overlay() - called\n")); - if ((src_w == (WINDOW *)NULL) || (dst_w == (WINDOW *)NULL)) + if (!src_w || !dst_w) return ERR; first_col = max(dst_w->_begx, src_w->_begx); @@ -204,7 +204,7 @@ int overwrite(const WINDOW *src_w, WINDOW *dst_w) PDC_LOG(("overwrite() - called\n")); - if ((src_w == (WINDOW *)NULL) || (dst_w == (WINDOW *)NULL)) + if (!src_w || !dst_w) return ERR; first_col = max(dst_w->_begx, src_w->_begx); @@ -265,10 +265,7 @@ int copywin(const WINDOW *src_w, WINDOW *dst_w, int src_tr, PDC_LOG(("copywin() - called\n")); - if (src_w == (WINDOW *)NULL || dst_w == (WINDOW *)NULL) - return ERR; - - if (dst_w == curscr) + if (!src_w || !dst_w || dst_w == curscr) return ERR; if (dst_br > dst_w->_maxy || dst_bc > dst_w->_maxx || diff --git a/pdcurses/pad.c b/pdcurses/pad.c index 1a2ed005..3a7334bd 100644 --- a/pdcurses/pad.c +++ b/pdcurses/pad.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Id: pad.c,v 1.35 2006/10/23 05:46:32 wmcbrine Exp $"); +RCSID("$Id: pad.c,v 1.36 2006/11/05 03:57:26 wmcbrine Exp $"); /* save values for pechochar() */ @@ -221,7 +221,7 @@ int pnoutrefresh(WINDOW *w, int py, int px, int sy1, int sx1, int sy2, int sx2) PDC_LOG(("pnoutrefresh() - called\n")); - if ((w == (WINDOW *)NULL) || !(w->_flags & (_PAD|_SUBPAD)) || + if (!w || !(w->_flags & (_PAD|_SUBPAD)) || (sy2 >= LINES) || (sy2 >= COLS)) return ERR; diff --git a/pdcurses/pdcdebug.c b/pdcurses/pdcdebug.c index 7f2eb2bc..516c979e 100644 --- a/pdcurses/pdcdebug.c +++ b/pdcurses/pdcdebug.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Id: pdcdebug.c,v 1.25 2006/10/23 05:55:01 wmcbrine Exp $"); +RCSID("$Id: pdcdebug.c,v 1.26 2006/11/05 03:57:26 wmcbrine Exp $"); bool pdc_trace_on = FALSE; @@ -45,7 +45,7 @@ void PDC_debug(const char *fmt, ...) /* open debug log file append */ dbfp = fopen("trace", "a"); - if (dbfp == NULL) + if (!dbfp) { fprintf(stderr, "PDC_debug(): Unable to open debug log file\n"); diff --git a/pdcurses/printw.c b/pdcurses/printw.c index 8d9830fc..ec101e3a 100644 --- a/pdcurses/printw.c +++ b/pdcurses/printw.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Id: printw.c,v 1.31 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: printw.c,v 1.32 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** diff --git a/pdcurses/refresh.c b/pdcurses/refresh.c index 67a57ecc..5e501fed 100644 --- a/pdcurses/refresh.c +++ b/pdcurses/refresh.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Id: refresh.c,v 1.42 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: refresh.c,v 1.43 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -80,7 +80,7 @@ int wnoutrefresh(WINDOW *win) PDC_LOG(("wnoutrefresh() - called: win=%p\n", win)); - if ( (win == (WINDOW *)NULL) || (win->_flags & (_PAD|_SUBPAD)) ) + if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) return ERR; begy = win->_begy; @@ -138,7 +138,7 @@ int doupdate(void) SP->alive = TRUE; /* so isendwin() result is correct */ } - if (curscr == (WINDOW *)NULL) + if (!curscr) return ERR; for (y = 0; y < SP->lines; y++) @@ -185,7 +185,7 @@ int wrefresh(WINDOW *win) PDC_LOG(("wrefresh() - called\n")); - if ( (win == (WINDOW *)NULL) || (win->_flags & (_PAD|_SUBPAD)) ) + if ( !win || (win->_flags & (_PAD|_SUBPAD)) ) return ERR; save_clear = win->_clear; @@ -215,8 +215,7 @@ int wredrawln(WINDOW *win, int start, int num) PDC_LOG(("wredrawln() - called: win=%p start=%d num=%d\n", win, start, num)); - if ((win == (WINDOW *)NULL) || - (start > win->_maxy || start + num > win->_maxy)) + if (!win || start > win->_maxy || start + num > win->_maxy) return ERR; for (i = start; i < start + num; i++) @@ -232,7 +231,7 @@ int redrawwin(WINDOW *win) { PDC_LOG(("redrawwin() - called: win=%p\n", win)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; return wredrawln(win, 0, win->_maxy); diff --git a/pdcurses/scroll.c b/pdcurses/scroll.c index e9b79c25..f10cc2ed 100644 --- a/pdcurses/scroll.c +++ b/pdcurses/scroll.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: scroll.c,v 1.26 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: scroll.c,v 1.27 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -55,7 +55,7 @@ int wscrl(WINDOW *win, int n) /* Check if window scrolls. Valid for window AND pad */ - if ((win == (WINDOW *)NULL) || !win->_scroll) + if (!win || !win->_scroll) return ERR; /* wrs (4/10/93) account for window background */ diff --git a/pdcurses/termattr.c b/pdcurses/termattr.c index 564c7b87..3b36804c 100644 --- a/pdcurses/termattr.c +++ b/pdcurses/termattr.c @@ -15,7 +15,7 @@ #include #include -RCSID("$Id: termattr.c,v 1.44 2006/10/23 06:09:36 wmcbrine Exp $"); +RCSID("$Id: termattr.c,v 1.45 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -190,7 +190,7 @@ int erasewchar(wchar_t *ch) { PDC_LOG(("erasewchar() - called\n")); - if (ch == (wchar_t *)NULL) + if (!ch) return ERR; *ch = (wchar_t)_ECHAR; @@ -202,7 +202,7 @@ int killwchar(wchar_t *ch) { PDC_LOG(("killwchar() - called\n")); - if (ch == (wchar_t *)NULL) + if (!ch) return ERR; *ch = (wchar_t)_DLCHAR; diff --git a/pdcurses/touch.c b/pdcurses/touch.c index ba9cb164..4754f7b3 100644 --- a/pdcurses/touch.c +++ b/pdcurses/touch.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: touch.c,v 1.22 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: touch.c,v 1.23 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -71,7 +71,7 @@ int touchwin(WINDOW *win) PDC_LOG(("touchwin() - called: Win=%x\n", win)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; for (i = 0; i < win->_maxy; i++) @@ -90,8 +90,7 @@ int touchline(WINDOW *win, int start, int count) PDC_LOG(("touchline() - called: win=%p start %d count %d\n", win, start, count)); - if ((win == (WINDOW *)NULL) || - (start > win->_maxy || start + count > win->_maxy)) + if (!win || start > win->_maxy || start + count > win->_maxy) return ERR; for (i = start; i < start + count; i++) @@ -109,7 +108,7 @@ int untouchwin(WINDOW *win) PDC_LOG(("untouchwin() - called: win=%p", win)); - if (win == (WINDOW *)NULL) + if (!win) return ERR; for (i = 0; i < win->_maxy; i++) @@ -128,7 +127,7 @@ int wtouchln(WINDOW *win, int y, int n, int changed) PDC_LOG(("wtouchln() - called: win=%p y=%d n=%d changed=%d\n", win, y, n, changed)); - if ((win == (WINDOW *)NULL) || (y > win->_maxy || y + n > win->_maxy)) + if (!win || y > win->_maxy || y + n > win->_maxy) return ERR; for (i = y; i < y + n; i++) @@ -152,7 +151,7 @@ bool is_linetouched(WINDOW *win, int line) { PDC_LOG(("is_linetouched() - called: win=%p line=%d\n", win, line)); - if ((win == NULL) || (line > win->_maxy || line < 0)) + if (!win || line > win->_maxy || line < 0) return FALSE; return (win->_firstch[line] != _NO_CHANGE) ? TRUE : FALSE; @@ -164,7 +163,7 @@ bool is_wintouched(WINDOW *win) PDC_LOG(("is_wintouched() - called: win=%p\n", win)); - if (win != NULL) + if (win) for (i = 0; i < win->_maxy; i++) if (win->_firstch[i] != _NO_CHANGE) return TRUE; diff --git a/pdcurses/window.c b/pdcurses/window.c index 6d496abe..0143a62d 100644 --- a/pdcurses/window.c +++ b/pdcurses/window.c @@ -14,7 +14,7 @@ #include #include -RCSID("$Id: window.c,v 1.43 2006/11/04 12:59:03 wmcbrine Exp $"); +RCSID("$Id: window.c,v 1.44 2006/11/05 03:57:26 wmcbrine Exp $"); /*man-start************************************************************** @@ -260,14 +260,14 @@ int delwin(WINDOW *win) PDC_LOG(("delwin() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; /* subwindows use parents' lines */ if (!(win->_flags & (_SUBWIN|_SUBPAD))) for (i = 0; i < win->_pmaxy && win->_y[i]; i++) - if (win->_y[i] != NULL) + if (win->_y[i]) free(win->_y[i]); free(win->_firstch); @@ -282,7 +282,7 @@ int mvwin(WINDOW *win, int y, int x) { PDC_LOG(("mvwin() - called\n")); - if ((win == (WINDOW *)NULL) + if (!win || (y + win->_maxy > LINES || y < 0) || (x + win->_maxx > COLS || x < 0)) return ERR; @@ -353,7 +353,7 @@ int mvderwin(WINDOW *win, int par_y, int par_x) int i, j; WINDOW *mypar; - if ((win == (WINDOW *)NULL) || (win->_parent == NULL)) + if (!win || !(win->_parent)) return ERR; mypar = win->_parent; @@ -461,7 +461,7 @@ WINDOW *resize_window(WINDOW *win, int lins, int cols) PDC_LOG(("resize_window() - called: lins %d cols %d\n", lins, cols)); - if (win == (WINDOW *)NULL) + if (!win) return (WINDOW *)NULL; if (win == SP->slk_winptr) @@ -554,7 +554,7 @@ int syncok(WINDOW *win, bool bf) { PDC_LOG(("syncok() - called\n")); - if (win == (WINDOW *)NULL) + if (!win) return ERR; win->_sync = bf;