Replaced "win == (WINDOW *)NULL" with "!win", etc. These were not used

consistently and, IMHO, are no more clear. To Do: Platform dirs.
This commit is contained in:
William McBrine
2006-11-05 03:57:26 +00:00
parent a4bb7076e4
commit 9790346bd3
30 changed files with 113 additions and 146 deletions

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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++)

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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);

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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)

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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)

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <string.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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 */

View File

@@ -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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;
}

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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];

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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**************************************************************

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <stdlib.h>
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)

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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)

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <string.h>
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);

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <string.h>
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++)

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <string.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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 ||

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <string.h>
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;

View File

@@ -16,7 +16,7 @@
#include <sys/types.h>
#include <time.h>
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");

View File

@@ -17,7 +17,7 @@
#include <curspriv.h>
#include <string.h>
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**************************************************************

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <string.h>
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);

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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 */

View File

@@ -15,7 +15,7 @@
#include <string.h>
#include <limits.h>
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;

View File

@@ -13,7 +13,7 @@
#include <curspriv.h>
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;

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <stdlib.h>
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;