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

@ -79,7 +79,7 @@ dodistribute(struct sctstr *sp, int imex, s_char *path, double dist_i_cost,
if ((sp->sct_dist_x == sp->sct_x) && (sp->sct_dist_y == sp->sct_y))
return 0;
if (path == (s_char *)0) {
if (!path) {
if (sp->sct_own != 0) {
if (imex == EXPORT) /* only want this once */
wu(0, sp->sct_own, "No path to dist sector for %s\n",

View file

@ -80,12 +80,12 @@ finish_sects(int etu)
int n;
struct distinfo *infptr;
if (g_distptrs == (struct distinfo *)0) {
if (g_distptrs == NULL) {
logerror("First update since reboot, allocating buffer\n");
/* Allocate the information buffer */
g_distptrs = (struct distinfo *)(malloc((WORLD_X * WORLD_Y) *
sizeof(struct distinfo)));
if (g_distptrs == (struct distinfo *)0) {
if (g_distptrs == NULL) {
logerror("malloc failed in finish_sects.\n");
return;
}
@ -191,7 +191,7 @@ assemble_dist_paths(struct distinfo *distptrs)
infptr = &distptrs[XYOFFSET(sp->sct_x, sp->sct_y)];
/* now, get the dist sector */
dist = getsectp(sp->sct_dist_x, sp->sct_dist_y);
if (dist == (struct sctstr *)0) {
if (dist == NULL) {
logerror("Bad dist sect %d,%d for %d,%d !\n", sp->sct_dist_x,
sp->sct_dist_y, sp->sct_x, sp->sct_y);
continue;
@ -202,13 +202,13 @@ assemble_dist_paths(struct distinfo *distptrs)
path = BestDistPath(buf, dist, sp, &d, MOB_ROAD);
/* Now, we have a path */
if (path != (s_char *)0) {
if (path != NULL) {
#ifdef SAVE_FINISH_PATHS
int len;
/* Here we malloc a buffer and save it */
len = strlen(path);
infptr->path = malloc(len);
if (infptr->path == (s_char *)0) {
if (infptr->path == NULL) {
logerror("malloc failed in assemble_dist_path!\n");
return;
}
@ -236,12 +236,12 @@ ReversePath(s_char *path)
static s_char new_path[512];
int ind;
if (path == (s_char *)0)
return (s_char *)0;
if (path == NULL)
return NULL;
ind = strlen(path);
if (ind == 0)
return (s_char *)0;
return NULL;
if (path[ind - 1] == 'h')
ind--;

View file

@ -102,7 +102,7 @@ update_main(void *unused)
bp = calloc(WORLD_X * WORLD_Y * 7, sizeof(int));
for (n = 0; n < MAXNOC; n++) {
money[n] = 0;
if ((np = getnatp(n)) == (struct natstr *)0)
if (!(np = getnatp(n)))
continue;
money[n] = np->nat_money;
tpops[n] = count_pop(n);
@ -118,7 +118,7 @@ update_main(void *unused)
memset(p_sect, 0, sizeof(p_sect));
mil_dbl_pay = 0;
if ((np = getnatp(x)) == (struct natstr *)0)
if (!(np = getnatp(x)))
continue;
if (np->nat_stat == STAT_SANCT) {
#ifdef DEBUG

View file

@ -63,7 +63,7 @@ nxtitemp(struct nstr_item *np)
np->cur++;
}
gp = ef_ptr(np->type, np->cur);
if (gp == (struct genitem *)0)
if (!gp)
return 0;
selected = 1;

View file

@ -103,7 +103,7 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
}
onship = 0;
shp = (struct shpstr *)0;
shp = NULL;
if (pp->pln_ship >= 0 && (buildem == 1)) {
if (pp->pln_effic >= 80)
continue;