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:
Markus Armbruster 2009-03-23 20:17:44 +01:00
parent 615681ce16
commit 90f8f2b099
15 changed files with 23 additions and 24 deletions

View file

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

View file

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

View file

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

View file

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