Don't use 0 as null pointer constant, part 2
This part replaces E != 0 by E, where E has pointer type.
This commit is contained in:
parent
615681ce16
commit
90f8f2b099
15 changed files with 23 additions and 24 deletions
|
@ -150,8 +150,8 @@ edit(void)
|
|||
}
|
||||
}
|
||||
for (;;) {
|
||||
if (player->argp[arg_index] != 0) {
|
||||
if (player->argp[arg_index+1] != 0) {
|
||||
if (player->argp[arg_index]) {
|
||||
if (player->argp[arg_index+1]) {
|
||||
thing = player->argp[arg_index++][0];
|
||||
ptr = player->argp[arg_index++];
|
||||
arg = atoi(ptr);
|
||||
|
|
|
@ -68,7 +68,7 @@ head(void)
|
|||
|
||||
(void)time(&now);
|
||||
natp = getnatp(player->cnum);
|
||||
if (player->argp[1] != 0 && *player->argp[1] != 0) {
|
||||
if (player->argp[1] && *player->argp[1]) {
|
||||
news_per = days(atoi(player->argp[1]));
|
||||
if (news_per > days(3))
|
||||
news_per = days(3);
|
||||
|
|
|
@ -100,7 +100,7 @@ info(void)
|
|||
return RET_FAIL;
|
||||
}
|
||||
|
||||
while ((dp = readdir(info_dp)) != 0) {
|
||||
while ((dp = readdir(info_dp))) {
|
||||
if (strncasecmp(name, dp->d_name, strlen(name)) != 0)
|
||||
continue;
|
||||
nmatch++;
|
||||
|
@ -153,7 +153,7 @@ info(void)
|
|||
return RET_FAIL;
|
||||
}
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp) != 0)
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
pr("%s", buf);
|
||||
(void)fclose(fp);
|
||||
return RET_OK;
|
||||
|
@ -207,7 +207,7 @@ apro(void)
|
|||
* search
|
||||
*/
|
||||
nf = nhf = nl = nhl = 0;
|
||||
while ((dp = readdir(info_dp)) != 0) {
|
||||
while ((dp = readdir(info_dp))) {
|
||||
if (dp->d_name[0] == '.')
|
||||
continue;
|
||||
snprintf(filename, sizeof(filename), "%s/%s", infodir,
|
||||
|
|
|
@ -86,7 +86,7 @@ thre(void)
|
|||
xyas(nstr.x, nstr.y, player->cnum), val);
|
||||
continue;
|
||||
}
|
||||
if (val > 0 && (player->argp[3] != 0 && *player->argp[3] != 0))
|
||||
if (val > 0 && player->argp[3] && *player->argp[3])
|
||||
pr("%s old threshold %d\n",
|
||||
xyas(nstr.x, nstr.y, player->cnum), val);
|
||||
sect.sct_dist[type] = thresh;
|
||||
|
|
|
@ -155,7 +155,7 @@ keylookup(char *command, struct keymatch *tbl)
|
|||
|
||||
if (command == 0 || *command == 0)
|
||||
return NULL;
|
||||
for (kp = tbl; kp->km_key != 0; kp++) {
|
||||
for (kp = tbl; kp->km_key; kp++) {
|
||||
if (strcmp(kp->km_key, command) == 0)
|
||||
return kp;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ demand_update_want(int *want, int *pop, int which)
|
|||
int whichwants;
|
||||
|
||||
whichwants = totpop = totwant = 0;
|
||||
for (cn = 1; 0 != (natp = getnatp(cn)); cn++) {
|
||||
for (cn = 1; (natp = getnatp(cn)); cn++) {
|
||||
/* Only countries which are normal. */
|
||||
/* Should probably include sanctuaries ..... */
|
||||
if (natp->nat_stat == STAT_ACTIVE) {
|
||||
|
|
|
@ -101,9 +101,9 @@ void
|
|||
io_close(struct iop *iop)
|
||||
{
|
||||
|
||||
if (iop->input != 0)
|
||||
if (iop->input)
|
||||
ioq_destroy(iop->input);
|
||||
if (iop->output != 0)
|
||||
if (iop->output)
|
||||
ioq_destroy(iop->output);
|
||||
(void)close(iop->fd);
|
||||
free(iop);
|
||||
|
|
|
@ -87,7 +87,7 @@ lwpSleepFd(int fd, int mask, struct timeval *timeout)
|
|||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
if (LwpFdwait[fd] != 0) {
|
||||
if (LwpFdwait[fd]) {
|
||||
lwpStatus(LwpCurrent,
|
||||
"multiple sleeps attempted on file descriptor %d", fd);
|
||||
errno = EBADF;
|
||||
|
@ -237,8 +237,7 @@ lwpSelect(void *arg)
|
|||
tv.tv_usec = 0;
|
||||
if (LwpDelayq.head) {
|
||||
time(&now);
|
||||
proc = LwpDelayq.head;
|
||||
for (; proc != 0; proc = proc->next) {
|
||||
for (proc = LwpDelayq.head; proc; proc = proc->next) {
|
||||
delta = proc->runtime - now;
|
||||
if (delta < tv.tv_sec)
|
||||
tv.tv_sec = delta;
|
||||
|
|
|
@ -52,7 +52,7 @@ comtch(char *command, struct cmndstr *coms, int comstat)
|
|||
if (command == 0 || *command == 0)
|
||||
return M_IGNORE;
|
||||
status = M_NOTFOUND;
|
||||
for (com = coms; com->c_form != 0; com++) {
|
||||
for (com = coms; com->c_form; com++) {
|
||||
if ((com->c_permit & comstat) != com->c_permit)
|
||||
continue;
|
||||
switch (mineq(command, com->c_form)) {
|
||||
|
|
|
@ -58,11 +58,11 @@ direrr(char *stop_msg, char *view_msg, char *map_msg)
|
|||
pr(" %c %c\n", dirch[DIR_UL], dirch[DIR_UR]);
|
||||
pr("%c %c\n", dirch[DIR_L], dirch[DIR_R]);
|
||||
pr(" %c %c\n", dirch[DIR_DL], dirch[DIR_DR]);
|
||||
if (stop_msg != 0)
|
||||
if (stop_msg)
|
||||
pr(stop_msg, dirch[DIR_STOP]);
|
||||
if (view_msg != 0)
|
||||
if (view_msg)
|
||||
pr(view_msg, dirch[DIR_VIEW]);
|
||||
if (map_msg != 0)
|
||||
if (map_msg)
|
||||
pr(map_msg, dirch[DIR_MAP]);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ sarg_type(char *str)
|
|||
return NS_DIST;
|
||||
if (c == '*')
|
||||
return NS_ALL;
|
||||
if (c == '#' || strchr(str, ',') != 0)
|
||||
if (c == '#' || strchr(str, ','))
|
||||
return NS_AREA;
|
||||
if (isdigit(c))
|
||||
return NS_LIST;
|
||||
|
|
|
@ -383,7 +383,7 @@ guerrilla(struct sctstr *sp)
|
|||
min_mil = val;
|
||||
}
|
||||
/* if we found a nice sector, go there */
|
||||
if (nicest_sp != 0) {
|
||||
if (nicest_sp) {
|
||||
nicest_sp->sct_che += che;
|
||||
nicest_sp->sct_che_target = target;
|
||||
che = 0;
|
||||
|
|
|
@ -317,11 +317,11 @@ sail_ship(natid cn)
|
|||
}
|
||||
|
||||
/* Free up the memory, 'cause I want to. */
|
||||
for (fltp = head; fltp != 0;) {
|
||||
for (fltp = head; fltp;) {
|
||||
struct fltelemstr *fe;
|
||||
struct fltheadstr *saveh;
|
||||
saveh = fltp->next;
|
||||
for (fe = fltp->head; fe != 0;) {
|
||||
for (fe = fltp->head; fe;) {
|
||||
struct fltelemstr *saveel;
|
||||
saveel = fe->next;
|
||||
free(fe);
|
||||
|
|
|
@ -422,7 +422,7 @@ shutdwn(int sig)
|
|||
logerror("Shutdown commencing (cleaning up threads.)");
|
||||
|
||||
play_wrlock_wanted = 1;
|
||||
for (p = player_next(NULL); p != 0; p = player_next(p)) {
|
||||
for (p = player_next(NULL); p; p = player_next(p)) {
|
||||
if (p->state != PS_PLAYING)
|
||||
continue;
|
||||
pr_flash(p, "Server shutting down...\n");
|
||||
|
|
|
@ -194,7 +194,7 @@ update_run(void)
|
|||
struct player *p;
|
||||
|
||||
play_wrlock_wanted = 1;
|
||||
for (p = player_next(NULL); p != 0; p = player_next(p)) {
|
||||
for (p = player_next(NULL); p; p = player_next(p)) {
|
||||
if (p->state != PS_PLAYING)
|
||||
continue;
|
||||
if (p->command) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue