This part replaces E != 0 by E, where E has pointer type.
}
}
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);
(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);
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++;
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;
* 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,
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;
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;
}
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) {
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);
errno = EBADF;
return -1;
}
- if (LwpFdwait[fd] != 0) {
+ if (LwpFdwait[fd]) {
lwpStatus(LwpCurrent,
"multiple sleeps attempted on file descriptor %d", fd);
errno = EBADF;
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;
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)) {
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]);
}
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;
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;
}
/* 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);
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");
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) {