Use NULL instead of (FOO *)0, it's easier to read.

This commit is contained in:
Markus Armbruster 2006-03-23 20:48:49 +00:00
parent 3252f8a907
commit 21bf6b41d4
23 changed files with 75 additions and 79 deletions

View file

@ -65,7 +65,7 @@ best(void)
if (s2.sct_own != player->cnum)
continue;
s = BestLandPath(buf, &s1, &s2, &cost, MOB_ROAD);
if (s != (s_char *)0)
if (s)
pr("Best path from %s to %s is %s (cost %1.3f)\n",
xyas(s1.sct_x, s1.sct_y, player->cnum),
xyas(s2.sct_x, s2.sct_y, player->cnum), s, cost);

View file

@ -413,7 +413,7 @@ comm_bomb(struct emp_qelem *list, struct sctstr *target)
pr("some %s\n", ip->i_name);
}
for (;;) {
ip = whatitem((s_char *)0, "commodity to bomb? ");
ip = whatitem(NULL, "commodity to bomb? ");
if (player->aborted)
return;
if (!ip)

View file

@ -102,7 +102,7 @@ dist(void)
path = BestDistPath(buf, &sect, &dsect, &move_cost, MOB_ROAD);
if (path == (s_char *)0) {
if (!path) {
pr("No owned path from %s to %s.\n",
xyas(dsect.sct_x, dsect.sct_y, player->cnum),
xyas(sect.sct_x, sect.sct_y, player->cnum));

View file

@ -224,9 +224,9 @@ nav_map(int x, int y, int show_designations)
int i;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static u_char *bitmap = (u_char *)0;
static s_char *wmapbuf = (s_char *)0;
static s_char **wmap = (s_char **)0;
static u_char *bitmap = NULL;
static s_char *wmapbuf = NULL;
static s_char **wmap = NULL;
s_char what[64];
int changed = 0;
@ -244,7 +244,7 @@ nav_map(int x, int y, int show_designations)
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
} else if (wmap) {
free(wmap);
wmap = (s_char **)0;
wmap = NULL;
}
}
if (!bitmap)

View file

@ -61,8 +61,8 @@ path(void)
s_char *pp, *p;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static s_char *mapbuf = (s_char *)0;
static s_char **map = (s_char **)0;
static s_char *mapbuf = NULL;
static s_char **map = NULL;
double move_cost;
s_char buf[1024];
@ -75,7 +75,7 @@ path(void)
}
getsect(sect.sct_dist_x, sect.sct_dist_y, &dsect);
pp = BestDistPath(buf, &sect, &dsect, &move_cost, MOB_ROAD);
if (pp == (s_char *)0) {
if (!pp) {
pr("No path possible from %s to distribution sector %s\n",
xyas(sect.sct_x, sect.sct_y, player->cnum),
xyas(dsect.sct_x, dsect.sct_y, player->cnum));
@ -90,7 +90,7 @@ path(void)
map[i] = &mapbuf[MAPWIDTH(3) * i];
} else if (map) {
free(map);
map = (s_char **)0;
map = NULL;
}
}
if (!mapbuf || !map) {

View file

@ -67,9 +67,9 @@ retr(void)
if (player->argp[2] != NULL)
pq = getstarg(player->argp[2], "Retreat path? ", buf1);
else
pq = (s_char *)0;
pq = NULL;
if (pq != (s_char *)0) {
if (pq != NULL) {
fl = getstarg(player->argp[3],
"Retreat conditions [i|t|s|h|b|d|u|c]? ", buf2);
if (!fl)
@ -129,7 +129,7 @@ retr(void)
}
if (rflags == -1)
pq = (s_char *)0;
pq = NULL;
zero = (rflags == -1);
if (zero)
@ -141,7 +141,7 @@ retr(void)
if (zero)
memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
if (pq != (s_char *)0) {
if (pq != NULL) {
strncpy(ship.shp_rpath, pq, sizeof(ship.shp_rpath));
putship(ship.shp_uid, &ship);
}
@ -215,8 +215,8 @@ lretr(void)
if (player->argp[2] != NULL)
pq = getstarg(player->argp[2], "Retreat path? ", buf1);
else
pq = (s_char *)0;
if (pq != (s_char *)0) {
pq = NULL;
if (pq != NULL) {
fl = getstarg(player->argp[3], "Retreat conditions [i|h|b|c]? ",
buf2);
if (!fl)
@ -256,7 +256,7 @@ lretr(void)
}
if (rflags == -1)
pq = (s_char *)0;
pq = NULL;
zero = (rflags == -1);
if (zero)
@ -268,7 +268,7 @@ lretr(void)
if (zero)
memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
if (pq != (s_char *)0) {
if (pq != NULL) {
strncpy(land.lnd_rpath, pq, sizeof(land.lnd_rpath));
putland(land.lnd_uid, &land);
}

View file

@ -67,9 +67,9 @@ rout(void)
s_char buf1[1024];
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static s_char *mapbuf = (s_char *)0;
static s_char **map = (s_char **)0;
static s_char *buf = (s_char *)0;
static s_char *mapbuf = NULL;
static s_char **map = NULL;
static s_char *buf = NULL;
int i;
if ((ip = whatitem(player->argp[1], "What item? ")) == 0)
@ -98,7 +98,7 @@ rout(void)
map[i] = &mapbuf[MAPWIDTH(3) * i];
} else if (map) {
free(map);
map = (s_char **)0;
map = NULL;
}
}
if (!buf)

View file

@ -62,8 +62,8 @@ sct(void)
s_char buf[1024];
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static s_char *mapbuf = (s_char *)0;
static s_char **map = (s_char **)0;
static s_char *mapbuf = NULL;
static s_char **map = NULL;
nsect = 0;
if (player->argp[1] == NULL) {
@ -90,7 +90,7 @@ sct(void)
map[i] = &mapbuf[MAPWIDTH(1) * i];
} else if (map) {
free(map);
map = (s_char **)0;
map = NULL;
}
}
if (!mapbuf || !map) {

View file

@ -70,8 +70,8 @@ surv(void)
s_char *str;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static s_char *mapbuf = (s_char *)0;
static s_char **map = (s_char **)0;
static s_char *mapbuf = NULL;
static s_char **map = NULL;
nsect = 0;
if ((ptr = getstarg(player->argp[1], "commodity or variable? ", buf)) == 0)
@ -109,7 +109,7 @@ surv(void)
map[i] = &mapbuf[MAPWIDTH(1) * i];
} else if (map) {
free(map);
map = (s_char **)0;
map = NULL;
}
}
if (!mapbuf || !map) {

View file

@ -78,7 +78,7 @@ terr(void)
sprintf(prompt, "%s %d%% %s territory? ",
xyas(nstr.x, nstr.y, player->cnum),
sect.sct_effic, dchr[sect.sct_type].d_name);
if ((p = getstarg((s_char *)0, prompt, buf)) == 0)
if ((p = getstarg(NULL, prompt, buf)) == 0)
return RET_FAIL;
if (!check_sect_ok(&sect))
return RET_FAIL;