diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index 2c0293d1..72eefce9 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -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); diff --git a/src/lib/commands/head.c b/src/lib/commands/head.c index 76a9662f..811a2734 100644 --- a/src/lib/commands/head.c +++ b/src/lib/commands/head.c @@ -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); diff --git a/src/lib/commands/info.c b/src/lib/commands/info.c index d5a6743c..8b3993a9 100644 --- a/src/lib/commands/info.c +++ b/src/lib/commands/info.c @@ -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, diff --git a/src/lib/commands/thre.c b/src/lib/commands/thre.c index 70290e68..568474ea 100644 --- a/src/lib/commands/thre.c +++ b/src/lib/commands/thre.c @@ -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; diff --git a/src/lib/common/emp_config.c b/src/lib/common/emp_config.c index 93d65cde..0186352e 100644 --- a/src/lib/common/emp_config.c +++ b/src/lib/common/emp_config.c @@ -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; } diff --git a/src/lib/common/wantupd.c b/src/lib/common/wantupd.c index 5b79aac1..694b07af 100644 --- a/src/lib/common/wantupd.c +++ b/src/lib/common/wantupd.c @@ -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) { diff --git a/src/lib/empthread/io.c b/src/lib/empthread/io.c index 3a48eae4..32aa9a02 100644 --- a/src/lib/empthread/io.c +++ b/src/lib/empthread/io.c @@ -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); diff --git a/src/lib/lwp/sel.c b/src/lib/lwp/sel.c index 0f726814..1a44d272 100644 --- a/src/lib/lwp/sel.c +++ b/src/lib/lwp/sel.c @@ -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; diff --git a/src/lib/subs/mtch.c b/src/lib/subs/mtch.c index 9b02f1d2..e6a2835b 100644 --- a/src/lib/subs/mtch.c +++ b/src/lib/subs/mtch.c @@ -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)) { diff --git a/src/lib/subs/paths.c b/src/lib/subs/paths.c index ae77fbb1..74871ad3 100644 --- a/src/lib/subs/paths.c +++ b/src/lib/subs/paths.c @@ -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]); } diff --git a/src/lib/subs/sarg.c b/src/lib/subs/sarg.c index 645f87a1..fbe69009 100644 --- a/src/lib/subs/sarg.c +++ b/src/lib/subs/sarg.c @@ -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; diff --git a/src/lib/update/revolt.c b/src/lib/update/revolt.c index 10f866bf..5b775e6d 100644 --- a/src/lib/update/revolt.c +++ b/src/lib/update/revolt.c @@ -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; diff --git a/src/lib/update/sail.c b/src/lib/update/sail.c index ba1376de..c10c211e 100644 --- a/src/lib/update/sail.c +++ b/src/lib/update/sail.c @@ -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); diff --git a/src/server/main.c b/src/server/main.c index e04884ce..44a4f9a4 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -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"); diff --git a/src/server/update.c b/src/server/update.c index cb73724f..704d6d3d 100644 --- a/src/server/update.c +++ b/src/server/update.c @@ -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) {