Don't use 0 as null pointer constant, part 1
Use NULL instead of 0, for clarity. Except in pointer comparisons; leave that to the next two commits.
This commit is contained in:
parent
a2ed975ec2
commit
615681ce16
51 changed files with 107 additions and 100 deletions
|
@ -74,7 +74,7 @@ assa(void)
|
|||
return RET_SYN;
|
||||
if (!sarg_xy(p, &def->x, &def->y))
|
||||
return RET_SYN;
|
||||
if (att_abort(A_ASSAULT, 0, def))
|
||||
if (att_abort(A_ASSAULT, NULL, def))
|
||||
return RET_FAIL;
|
||||
|
||||
/*
|
||||
|
@ -110,7 +110,7 @@ assa(void)
|
|||
if (att_abort(A_ASSAULT, off, def)) {
|
||||
pr("Assault aborted\n");
|
||||
att_empty_attack(A_ASSAULT, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
/* If we're assaulting our own sector, end here */
|
||||
|
@ -127,7 +127,7 @@ assa(void)
|
|||
if (att_abort(A_ASSAULT, off, def)) {
|
||||
pr("Assault aborted\n");
|
||||
att_empty_attack(A_ASSAULT, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -73,7 +73,7 @@ atta(void)
|
|||
return RET_SYN;
|
||||
if (!sarg_xy(p, &def->x, &def->y))
|
||||
return RET_SYN;
|
||||
if (att_abort(A_ATTACK, 0, def))
|
||||
if (att_abort(A_ATTACK, NULL, def))
|
||||
return RET_FAIL;
|
||||
|
||||
/* Show what we're attacking, and check treaties */
|
||||
|
@ -84,7 +84,7 @@ atta(void)
|
|||
/* Ask about offensive support */
|
||||
|
||||
att_ask_support(2, &fort_sup, &ship_sup, &land_sup, &plane_sup);
|
||||
if (att_abort(A_ATTACK, 0, def)) {
|
||||
if (att_abort(A_ATTACK, NULL, def)) {
|
||||
att_empty_attack(A_ATTACK, 0, def);
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ atta(void)
|
|||
if (att_abort(A_ATTACK, off, def)) {
|
||||
pr("Attack aborted\n");
|
||||
att_empty_attack(A_ATTACK, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
ototal = att_get_offense(A_ATTACK, off, &olist, def);
|
||||
if (att_abort(A_ATTACK, off, def)) {
|
||||
pr("Attack aborted\n");
|
||||
att_empty_attack(A_ATTACK, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -136,14 +136,14 @@ boar(void)
|
|||
if (att_abort(A_BOARD, off, def)) {
|
||||
pr("Board aborted\n");
|
||||
att_empty_attack(A_BOARD, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
ototal = att_get_offense(A_BOARD, off, &olist, def);
|
||||
if (att_abort(A_BOARD, off, def)) {
|
||||
pr("Board aborted\n");
|
||||
att_empty_attack(A_BOARD, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -122,7 +122,7 @@ bomb(void)
|
|||
(void)pathtoxy(flightpath, &tx, &ty, fcost);
|
||||
pr("target sector is %s\n", xyas(tx, ty, player->cnum));
|
||||
getsect(tx, ty, &target);
|
||||
ip = 0;
|
||||
ip = NULL;
|
||||
ap_to_target = strlen(flightpath);
|
||||
if (flightpath[ap_to_target - 1] == 'h')
|
||||
ap_to_target--;
|
||||
|
|
|
@ -540,7 +540,7 @@ build_bridge(struct sctstr *sp, short *vec)
|
|||
|
||||
if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
|
||||
pr("'%c' is not a valid direction...\n", *p);
|
||||
direrr(0, 0, 0);
|
||||
direrr(NULL, NULL, NULL);
|
||||
return 0;
|
||||
}
|
||||
newx = sp->sct_x + diroff[val][0];
|
||||
|
@ -816,7 +816,7 @@ build_tower(struct sctstr *sp, short *vec)
|
|||
|
||||
if ((val = chkdir(*p, DIR_FIRST, DIR_LAST)) < 0) {
|
||||
pr("'%c' is not a valid direction...\n", *p);
|
||||
direrr(0, 0, 0);
|
||||
direrr(NULL, NULL, NULL);
|
||||
return 0;
|
||||
}
|
||||
newx = sp->sct_x + diroff[val][0];
|
||||
|
|
|
@ -70,7 +70,7 @@ coas(void)
|
|||
if (!snxtsct(&nstr, player->argp[1]))
|
||||
return RET_SYN;
|
||||
for (i = 0; i < TSIZE; i++)
|
||||
list[i] = 0;
|
||||
list[i] = NULL;
|
||||
cp = malloc(sizeof(*cp));
|
||||
snxtitem_all(&ni, EF_SHIP);
|
||||
while (nxtitem(&ni, &cp->c_shp)) {
|
||||
|
@ -139,18 +139,18 @@ static int
|
|||
showship(struct coast **cpp, int x, int y)
|
||||
{
|
||||
struct coast *cp;
|
||||
struct coast *todelete = 0;
|
||||
struct coast *todelete = NULL;
|
||||
struct coast **prev;
|
||||
int nship = 0;
|
||||
|
||||
prev = 0;
|
||||
prev = NULL;
|
||||
cp = *cpp;
|
||||
prev = cpp;
|
||||
do {
|
||||
/* we delete it, we free it. */
|
||||
if (todelete) {
|
||||
free(todelete);
|
||||
todelete = 0;
|
||||
todelete = NULL;
|
||||
}
|
||||
if (cp->c_shp.shp_x != x || cp->c_shp.shp_y != y) {
|
||||
prev = &(*prev)->c_next;
|
||||
|
|
|
@ -119,7 +119,7 @@ explore(void)
|
|||
pr("Only exploring with %d.\n", amount);
|
||||
}
|
||||
|
||||
if (!want_to_abandon(§, vtype, amount, 0)) {
|
||||
if (!want_to_abandon(§, vtype, amount, NULL)) {
|
||||
pr("Explore cancelled.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ sendmessage(struct natstr *us, struct natstr *to, char *message, int verbose)
|
|||
|
||||
time(&now);
|
||||
tm = localtime(&now);
|
||||
for (other = player_next(0); other != 0; other = player_next(other)) {
|
||||
for (other = player_next(NULL); other; other = player_next(other)) {
|
||||
if (other->state != PS_PLAYING)
|
||||
continue;
|
||||
if (to && other->cnum != to->nat_cnum)
|
||||
|
|
|
@ -107,14 +107,14 @@ lboa(void)
|
|||
if (att_abort(A_LBOARD, off, def)) {
|
||||
pr("Land unit boarding aborted\n");
|
||||
att_empty_attack(A_LBOARD, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
ototal = att_get_offense(A_LBOARD, off, &olist, def);
|
||||
if (att_abort(A_LBOARD, off, def)) {
|
||||
pr("Land unit boarding aborted\n");
|
||||
att_empty_attack(A_LBOARD, 0, def);
|
||||
return att_free_lists(&olist, 0);
|
||||
return att_free_lists(&olist, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -706,7 +706,7 @@ load_comm_ship(struct sctstr *sectp, struct shpstr *sp,
|
|||
load_unload, atoi(p));
|
||||
if (!load_comm_ok(sectp, sp->shp_own, item, move_amt))
|
||||
return RET_OK;
|
||||
if (!want_to_abandon(sectp, item, move_amt, 0))
|
||||
if (!want_to_abandon(sectp, item, move_amt, NULL))
|
||||
return RET_FAIL;
|
||||
if (!still_ok_ship(sectp, sp))
|
||||
return RET_SYN;
|
||||
|
|
|
@ -140,7 +140,7 @@ move(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (!istest && !want_to_abandon(§, vtype, amount, 0)) {
|
||||
if (!istest && !want_to_abandon(§, vtype, amount, NULL)) {
|
||||
pr("Move cancelled.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ paradrop(struct emp_qelem *list, coord x, coord y)
|
|||
att_combat_init(def, EF_SECTOR);
|
||||
def->x = x;
|
||||
def->y = y;
|
||||
if (att_abort(A_PARA, 0, def))
|
||||
if (att_abort(A_PARA, NULL, def))
|
||||
return RET_FAIL;
|
||||
|
||||
/* Show what we're air-assaulting, and check treaties */
|
||||
|
|
|
@ -47,7 +47,7 @@ play(void)
|
|||
int saw = 0;
|
||||
|
||||
play_header();
|
||||
for (joe = player_prev(0); joe; joe = player_prev(joe)) {
|
||||
for (joe = player_prev(NULL); joe; joe = player_prev(joe)) {
|
||||
saw += play_list(joe);
|
||||
}
|
||||
if (player->god || opt_BLITZ)
|
||||
|
|
|
@ -97,12 +97,12 @@ reco(void)
|
|||
/*
|
||||
* now arm and equip the bombers, transports, whatever.
|
||||
*/
|
||||
pln_arm(&bomb_list, ap_to_target, 'r', 0, P_S | P_I);
|
||||
pln_arm(&bomb_list, ap_to_target, 'r', NULL, P_S | P_I);
|
||||
if (QEMPTY(&bomb_list)) {
|
||||
pr("No planes could be equipped for the mission.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
pln_arm(&esc_list, ap_to_target, 'r', 0, P_F | P_ESC);
|
||||
pln_arm(&esc_list, ap_to_target, 'r', NULL, P_F | P_ESC);
|
||||
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath,
|
||||
*player->argp[0] == 's' ? PM_R | PM_S : PM_R);
|
||||
if (QEMPTY(&bomb_list)) {
|
||||
|
|
|
@ -68,7 +68,7 @@ skyw(void)
|
|||
if (!snxtsct(&nstr, player->argp[1]))
|
||||
return RET_SYN;
|
||||
for (i = 0; i < TSIZE; i++)
|
||||
list[i] = 0;
|
||||
list[i] = NULL;
|
||||
skyp = malloc(sizeof(*skyp));
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, &skyp->s_sat)) {
|
||||
|
@ -131,20 +131,20 @@ static int
|
|||
showsat(struct sky **skypp, int x, int y)
|
||||
{
|
||||
struct sky *skyp;
|
||||
struct sky *todelete = 0;
|
||||
struct sky *todelete = NULL;
|
||||
struct sky **prev;
|
||||
struct plchrstr *pcp;
|
||||
char *name;
|
||||
int nsat = 0;
|
||||
|
||||
prev = 0;
|
||||
prev = NULL;
|
||||
skyp = *skypp;
|
||||
prev = skypp;
|
||||
do {
|
||||
/* we delete it, we free it. */
|
||||
if (todelete) {
|
||||
free(todelete);
|
||||
todelete = 0;
|
||||
todelete = NULL;
|
||||
}
|
||||
if (skyp->s_sat.pln_x != x || skyp->s_sat.pln_y != y) {
|
||||
prev = &(*prev)->s_next;
|
||||
|
|
|
@ -82,7 +82,7 @@ stre(void)
|
|||
pr("%7s", "");
|
||||
|
||||
if (def->sct_type != SCT_MOUNT)
|
||||
r_total = att_reacting_units(def, 0, 0, &dummy, 9999999);
|
||||
r_total = att_reacting_units(def, NULL, 0, &dummy, 9999999);
|
||||
else
|
||||
r_total = 0.0;
|
||||
def->own = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue