]> git.pond.sub.org Git - empserver/commitdiff
Don't use 0 as null pointer constant, part 1
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 22 Mar 2009 17:50:43 +0000 (18:50 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 24 Mar 2009 20:45:44 +0000 (21:45 +0100)
Use NULL instead of 0, for clarity.  Except in pointer comparisons;
leave that to the next two commits.

51 files changed:
doc/coding
src/client/termlib.c
src/lib/commands/assa.c
src/lib/commands/atta.c
src/lib/commands/boar.c
src/lib/commands/bomb.c
src/lib/commands/buil.c
src/lib/commands/coas.c
src/lib/commands/expl.c
src/lib/commands/flash.c
src/lib/commands/lboard.c
src/lib/commands/load.c
src/lib/commands/move.c
src/lib/commands/para.c
src/lib/commands/play.c
src/lib/commands/reco.c
src/lib/commands/skyw.c
src/lib/commands/stre.c
src/lib/common/emp_config.c
src/lib/common/nat.c
src/lib/common/path.c
src/lib/empthread/io.c
src/lib/empthread/lwp.c
src/lib/gen/ioqueue.c
src/lib/lwp/lwp.c
src/lib/lwp/queue.c
src/lib/lwp/sel.c
src/lib/lwp/status.c
src/lib/player/accept.c
src/lib/player/empmod.c
src/lib/player/login.c
src/lib/subs/aircombat.c
src/lib/subs/attsub.c
src/lib/subs/getstarg.c
src/lib/subs/list.c
src/lib/subs/lndsub.c
src/lib/subs/mission.c
src/lib/subs/mslsub.c
src/lib/subs/pr.c
src/lib/subs/rej.c
src/lib/subs/shpsub.c
src/lib/subs/unitsub.c
src/lib/subs/whatitem.c
src/lib/update/nxtitemp.c
src/lib/update/plague.c
src/lib/update/populace.c
src/lib/update/revolt.c
src/lib/update/sail.c
src/lib/update/sect.c
src/server/main.c
src/server/update.c

index e3d8c69457f8e73a493722ca7d115e6d9a08b965..184e1b5cfa25bbcb405cc435b7c26fa8b53718c6 100644 (file)
@@ -288,6 +288,10 @@ Do not use increment operators to set a variable to logical true!  It
 obfuscates the purpose, and narrow variables could even overflow.
 Just assign 1.  A lot of cleanup remains to be done there.
 
 obfuscates the purpose, and narrow variables could even overflow.
 Just assign 1.  A lot of cleanup remains to be done there.
 
+Null pointer constant
+
+Please use NULL for clarity, not just 0.
+
 Type casts
 
 Casting pointers to and from `void *' clutters the code and serves no
 Type casts
 
 Casting pointers to and from `void *' clutters the code and serves no
index 7a3efe1b765acb8ccb1ad4b115e459b9ccd6e806..ad664908cb807105b8138e48ab7870073c0adeef 100644 (file)
@@ -42,8 +42,8 @@
 #include <unistd.h>
 #include "misc.h"
 
 #include <unistd.h>
 #include "misc.h"
 
-static char *smso = 0;
-static char *rmso = 0;
+static char *smso;
+static char *rmso;
 
 void
 getsose(void)
 
 void
 getsose(void)
index 97b138c4ad21e27a8ac63973bf49f8194497a3d5..f8531bde5f9ed9c9fc84b47eeed3b6b957f79d06 100644 (file)
@@ -74,7 +74,7 @@ assa(void)
        return RET_SYN;
     if (!sarg_xy(p, &def->x, &def->y))
        return RET_SYN;
        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;
 
     /*
        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);
     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 */
     }
 
     /* 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);
     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);
     }
 
     /*
     }
 
     /*
index 9cfca76e849c18e084d4682cd957eaa80ba51c11..99e87e1866ce2ab98224aae3ceb439703e3c4ce6 100644 (file)
@@ -73,7 +73,7 @@ atta(void)
        return RET_SYN;
     if (!sarg_xy(p, &def->x, &def->y))
        return RET_SYN;
        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 */
        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);
     /* 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;
     }
        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);
     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);
     }
 
     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);
     }
 
     /*
     }
 
     /*
index 48245d3d6126ceb0a2f4b9aad3e70fbe73e653d3..f357a728d42a83636be47e418344671eace9bdff 100644 (file)
@@ -136,14 +136,14 @@ boar(void)
     if (att_abort(A_BOARD, off, def)) {
        pr("Board aborted\n");
        att_empty_attack(A_BOARD, 0, 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);
     }
 
     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);
     }
 
     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);
     }
 
     /*
     }
 
     /*
index f959e06d77a19fd0c3ee5698649ba2993e384324..19de35bbc9ba1a1a66877f5cfbc5b07bd461b289 100644 (file)
@@ -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);
     (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--;
     ap_to_target = strlen(flightpath);
     if (flightpath[ap_to_target - 1] == 'h')
        ap_to_target--;
index a7a1cee23fb8beae8cf0ca624677835718b9a569..4cd38f1d551ad8ec1e35ec3b66a4b7e52fcc4b96 100644 (file)
@@ -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);
 
     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];
        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);
 
     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];
        return 0;
     }
     newx = sp->sct_x + diroff[val][0];
index 174b5406f00349711c2c7c52db51d4550a059900..0ba06e2e2008e594d6aff90c2b9fe5f669d35a09 100644 (file)
@@ -70,7 +70,7 @@ coas(void)
     if (!snxtsct(&nstr, player->argp[1]))
        return RET_SYN;
     for (i = 0; i < TSIZE; i++)
     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)) {
     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;
 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;
 
     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);
     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;
        }
        if (cp->c_shp.shp_x != x || cp->c_shp.shp_y != y) {
            prev = &(*prev)->c_next;
index ce5d5beaf26763d96a98afe210b2b90eb91f3723..c34a39c6b5a7e7b466dab7a501bfcbef92e4075e 100644 (file)
@@ -119,7 +119,7 @@ explore(void)
        pr("Only exploring with %d.\n", amount);
     }
 
        pr("Only exploring with %d.\n", amount);
     }
 
-    if (!want_to_abandon(&sect, vtype, amount, 0)) {
+    if (!want_to_abandon(&sect, vtype, amount, NULL)) {
        pr("Explore cancelled.\n");
        return RET_FAIL;
     }
        pr("Explore cancelled.\n");
        return RET_FAIL;
     }
index a5cd1edc8251cfe929f90f1baa36d2f08a4ffcff..10655161d27e3c6829c17a094989c1aa1621a4d9 100644 (file)
@@ -124,7 +124,7 @@ sendmessage(struct natstr *us, struct natstr *to, char *message, int verbose)
 
     time(&now);
     tm = localtime(&now);
 
     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)
        if (other->state != PS_PLAYING)
            continue;
        if (to && other->cnum != to->nat_cnum)
index d35e3ec039d91cbbbd2385a09a42676c807ca77a..6602e43ce823bce97117915c37060ff4dc2ca700 100644 (file)
@@ -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);
     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);
     }
 
     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);
     }
 
     /*
     }
 
     /*
index 5637c40b5215352a1e4ea51485278fbef7a5e69d..e96d1484747564eafd5a9a3bf207b1070f71318c 100644 (file)
@@ -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;
                           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;
        return RET_FAIL;
     if (!still_ok_ship(sectp, sp))
        return RET_SYN;
index 7c915b8ff6f1b724e79c63663db201df5b10b6f8..005a10cf2914a5ff87fde472e139127116bd2975 100644 (file)
@@ -140,7 +140,7 @@ move(void)
        }
     }
 
        }
     }
 
-    if (!istest && !want_to_abandon(&sect, vtype, amount, 0)) {
+    if (!istest && !want_to_abandon(&sect, vtype, amount, NULL)) {
        pr("Move cancelled.\n");
        return RET_FAIL;
     }
        pr("Move cancelled.\n");
        return RET_FAIL;
     }
index ef41218ee9092cc20257318330c8cbed8a03f8c4..fec94553e39eef8614fc22650943875562286d18 100644 (file)
@@ -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;
     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 */
        return RET_FAIL;
 
     /* Show what we're air-assaulting, and check treaties */
index c548b653caf930b95fa8f7dc5bc6e5cc254823c7..84f68f999793bb0df0ec4bb47dfff49d8ba877e8 100644 (file)
@@ -47,7 +47,7 @@ play(void)
     int saw = 0;
 
     play_header();
     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)
        saw += play_list(joe);
     }
     if (player->god || opt_BLITZ)
index 920f2abde00c191a95f55c674dea16852f517dfe..b0fb44583a902f181b4bd324fdb59f67bc030d33 100644 (file)
@@ -97,12 +97,12 @@ reco(void)
     /*
      * now arm and equip the bombers, transports, whatever.
      */
     /*
      * 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;
     }
     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)) {
     ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath,
                 *player->argp[0] == 's' ? PM_R | PM_S : PM_R);
     if (QEMPTY(&bomb_list)) {
index 4e659bcc038b9c1e9c7ebb662628880c9c29a010..95003e87a8e2808c71c70a3680128dde541c6606 100644 (file)
@@ -68,7 +68,7 @@ skyw(void)
     if (!snxtsct(&nstr, player->argp[1]))
        return RET_SYN;
     for (i = 0; i < TSIZE; i++)
     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)) {
     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;
 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;
 
     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);
     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;
        }
        if (skyp->s_sat.pln_x != x || skyp->s_sat.pln_y != y) {
            prev = &(*prev)->s_next;
index 20a96083f623c3197e535987dfa775945a49185f..f65525221529d28de1232fc2103c85e550fb95d2 100644 (file)
@@ -82,7 +82,7 @@ stre(void)
            pr("%7s", "");
 
        if (def->sct_type != SCT_MOUNT)
            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;
        else
            r_total = 0.0;
        def->own = 0;
index 6431797e5c31a0b63e1256ad276e4b2502eeb7bd..93d65cde5e5bd13a3ca8481ecb9978e31a667176 100644 (file)
@@ -154,7 +154,7 @@ keylookup(char *command, struct keymatch *tbl)
     struct keymatch *kp;
 
     if (command == 0 || *command == 0)
     struct keymatch *kp;
 
     if (command == 0 || *command == 0)
-       return 0;
+       return NULL;
     for (kp = tbl; kp->km_key != 0; kp++) {
        if (strcmp(kp->km_key, command) == 0)
            return kp;
     for (kp = tbl; kp->km_key != 0; kp++) {
        if (strcmp(kp->km_key, command) == 0)
            return kp;
index ab0613f1c385b1870227a271b30955251b798777..a4fec30fb29ebffade46d94c9eb489af2599636e 100644 (file)
@@ -50,7 +50,7 @@ cname(natid n)
     struct natstr *np;
 
     if ((np = getnatp(n)) == 0)
     struct natstr *np;
 
     if ((np = getnatp(n)) == 0)
-       return 0;
+       return NULL;
     return np->nat_cnam;
 }
 
     return np->nat_cnam;
 }
 
index 8dd74b945ab9d28e31f4f8f3494d20d570b8537c..40abdfbb1553d278c960b75e1b1210e6bea3e4c3 100644 (file)
@@ -185,7 +185,7 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
     int n = 0, q;
     struct sctstr *sp, *from, **ssp;
     /* Six pointers, just in case our cache isn't there */
     int n = 0, q;
     struct sctstr *sp, *from, **ssp;
     /* Six pointers, just in case our cache isn't there */
-    struct sctstr *tsp[] = { 0, 0, 0, 0, 0, 0 };
+    struct sctstr *tsp[] = { NULL, NULL, NULL, NULL, NULL, NULL };
     int sx, sy, offset;
 
     x = c.x;
     int sx, sy, offset;
 
     x = c.x;
index 5bbce8d9761eeec09437520c7ad7ba63e40d3243..3a48eae4bd126ee1ea595dd8c8fc1c124209b863 100644 (file)
@@ -82,8 +82,8 @@ io_open(int fd, int flags, int bufsize, struct timeval timeout)
     if (!iop)
        return NULL;
     iop->fd = fd;
     if (!iop)
        return NULL;
     iop->fd = fd;
-    iop->input = 0;
-    iop->output = 0;
+    iop->input = NULL;
+    iop->output = NULL;
     iop->flags = 0;
     iop->input_timeout = timeout;
     iop->bufsize = bufsize;
     iop->flags = 0;
     iop->input_timeout = timeout;
     iop->bufsize = bufsize;
index 03bf4a64d18050cb8c427a8b6c5044f0a0f03c33..71f3fc3651092c3de82c6ca92abfc8ab66c7cf27 100644 (file)
@@ -65,7 +65,7 @@ empth_create(void (*entry)(void *), int size, int flags,
 {
     if (!flags)
        flags = empth_flags;
 {
     if (!flags)
        flags = empth_flags;
-    return lwpCreate(1, entry, size, flags, name, 0, 0, ud);
+    return lwpCreate(1, entry, size, flags, name, 0, NULL, ud);
 }
 
 empth_t *
 }
 
 empth_t *
index 96e2da13f73d2cf28b5248cde93e0bbe38de93c4..655a364dc66ec214a922fb37a57b6d9d7e288ea5 100644 (file)
@@ -62,7 +62,7 @@ ioq_create(int size)
     ioq->list.nbytes = 0;
     ioq->list.offset = 0;
     ioq->list.size = 0;
     ioq->list.nbytes = 0;
     ioq->list.offset = 0;
     ioq->list.size = 0;
-    ioq->list.data = 0;
+    ioq->list.data = NULL;
     ioq->bufsize = size;
     ioq->cc = 0;
     return ioq;
     ioq->bufsize = size;
     ioq->cc = 0;
     return ioq;
index 748b6c6ad7c781b104ae118b5bfea1f6e8a59a17..6a47ac61252443040ae644819e1bda0ff99f2868 100644 (file)
@@ -98,7 +98,7 @@ lwpReschedule(void)
            } else {
                lwpDestroy(nextp);
            }
            } else {
                lwpDestroy(nextp);
            }
-           nextp = 0;
+           nextp = NULL;
        }
        if (nextp)
            break;
        }
        if (nextp)
            break;
@@ -315,18 +315,19 @@ lwpInitSystem(int pri, void **ctxptr, int flags, sigset_t *waitset)
        pri = LWP_MAX_PRIO - 1;
     if (LwpMaxpri < pri)
        LwpMaxpri = pri;
        pri = LWP_MAX_PRIO - 1;
     if (LwpMaxpri < pri)
        LwpMaxpri = pri;
-    LwpCurrent->next = 0;
+    LwpCurrent->next = NULL;
     LwpCurrent->sbtm = stack;  /* dummy stack for "main" */
     LwpCurrent->pri = pri;
     LwpCurrent->dead = 0;
     LwpCurrent->flags = flags & ~LWP_STACKCHECK;
     LwpCurrent->name = "Main";
     for (i = LWP_MAX_PRIO, q = LwpSchedQ; i--; q++)
     LwpCurrent->sbtm = stack;  /* dummy stack for "main" */
     LwpCurrent->pri = pri;
     LwpCurrent->dead = 0;
     LwpCurrent->flags = flags & ~LWP_STACKCHECK;
     LwpCurrent->name = "Main";
     for (i = LWP_MAX_PRIO, q = LwpSchedQ; i--; q++)
-       q->head = q->tail = 0;
-    LwpDeadQ.head = LwpDeadQ.tail = 0;
+       q->head = q->tail = NULL;
+    LwpDeadQ.head = LwpDeadQ.tail = NULL;
     lwpInitSigWait(waitset);
     /* must be lower in priority than us for this to work right */
     lwpInitSigWait(waitset);
     /* must be lower in priority than us for this to work right */
-    sel = lwpCreate(0, lwpSelect, 16384, flags, "EventHandler", 0, 0, 0);
+    sel = lwpCreate(0, lwpSelect, 16384, flags, "EventHandler", 0,
+                   NULL, NULL);
     lwpInitSelect(sel);
     return LwpCurrent;
 }
     lwpInitSelect(sel);
     return LwpCurrent;
 }
index f9f86173d52dad2965495db657a06c4769e741f2..10df182ac2e03281343727c8ae1a9238aa02d7a6 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <config.h>
 
 
 #include <config.h>
 
+#include <stddef.h>
 #include "lwp.h"
 #include "lwpint.h"
 
 #include "lwp.h"
 #include "lwpint.h"
 
@@ -43,7 +44,7 @@ lwpGetFirst(struct lwpQueue *q)
     struct lwpProc *head;
 
     if ((head = q->head) && !(q->head = head->next))
     struct lwpProc *head;
 
     if ((head = q->head) && !(q->head = head->next))
-       q->tail = 0;
+       q->tail = NULL;
     return head;
 }
 
     return head;
 }
 
@@ -55,5 +56,5 @@ lwpAddTail(struct lwpQueue *q, struct lwpProc *p)
     else
        q->tail->next = p;
     q->tail = p;
     else
        q->tail->next = p;
     q->tail = p;
-    p->next = 0;
+    p->next = NULL;
 }
 }
index 5c89df5d4cf48c4b8813caf2496c2a2dda838b8a..0f72681470bee9354c0384a2e2eb6813fa437250 100644 (file)
@@ -73,8 +73,8 @@ lwpInitSelect(struct lwpProc *proc)
     FD_ZERO(&LwpReadfds);
     FD_ZERO(&LwpWritefds);
     LwpFdwait = calloc(FD_SETSIZE, sizeof(struct lwpProc *));
     FD_ZERO(&LwpReadfds);
     FD_ZERO(&LwpWritefds);
     LwpFdwait = calloc(FD_SETSIZE, sizeof(struct lwpProc *));
-    LwpDelayq.head = 0;
-    LwpDelayq.tail = 0;
+    LwpDelayq.head = NULL;
+    LwpDelayq.tail = NULL;
     LwpSelProc = proc;
 }
 
     LwpSelProc = proc;
 }
 
@@ -141,7 +141,7 @@ lwpWakeupFd(struct lwpProc *proc)
     FD_CLR(proc->fd, &LwpReadfds);
     FD_CLR(proc->fd, &LwpWritefds);
     LwpNfds--;
     FD_CLR(proc->fd, &LwpReadfds);
     FD_CLR(proc->fd, &LwpWritefds);
     LwpNfds--;
-    LwpFdwait[proc->fd] = 0;
+    LwpFdwait[proc->fd] = NULL;
     proc->fd = -1;
     lwpReady(proc);
 }
     proc->fd = -1;
     lwpReady(proc);
 }
@@ -158,7 +158,7 @@ lwpWakeupSleep(void)
 
     if (LwpDelayq.head) {
        now = time(NULL);
 
     if (LwpDelayq.head) {
        now = time(NULL);
-       save.tail = save.head = 0;
+       save.tail = save.head = NULL;
        while (NULL != (proc = lwpGetFirst(&LwpDelayq))) {
            if (now >= proc->runtime) {
                lwpStatus(proc, "sleep done");
        while (NULL != (proc = lwpGetFirst(&LwpDelayq))) {
            if (now >= proc->runtime) {
                lwpStatus(proc, "sleep done");
index 72056bf7dcf90470a95bacdddd7569188b968eea..23d64a50a8ab30b4c7b5bb85f2c92565fda3ff5f 100644 (file)
@@ -51,8 +51,8 @@ lwpStatus(struct lwpProc *proc, char *format, ...)
     va_start(ap, format);
     if (proc->flags & LWP_PRINT) {
        if (startTime.tv_sec == 0)
     va_start(ap, format);
     if (proc->flags & LWP_PRINT) {
        if (startTime.tv_sec == 0)
-           gettimeofday(&startTime, 0);
-       gettimeofday(&tv, 0);
+           gettimeofday(&startTime, NULL);
+       gettimeofday(&tv, NULL);
        sec = tv.tv_sec - startTime.tv_sec;
        msec = (tv.tv_usec - startTime.tv_usec) / 1000;
        if (msec < 0) {
        sec = tv.tv_sec - startTime.tv_sec;
        msec = (tv.tv_usec - startTime.tv_usec) / 1000;
        if (msec < 0) {
index f2a798d6776ce4b8886b606329345ba40077d05a..474a51afe6f1e91a6fbd02e6033b9244b40c2117 100644 (file)
@@ -107,7 +107,7 @@ player_delete(struct player *lp)
     if (lp->iop) {
        /* it's a real player */
        io_close(lp->iop);
     if (lp->iop) {
        /* it's a real player */
        io_close(lp->iop);
-       lp->iop = 0;
+       lp->iop = NULL;
     }
     free(lp);
     /* XXX may need to free bigmap here */
     }
     free(lp);
     /* XXX may need to free bigmap here */
@@ -122,7 +122,7 @@ player_next(struct player *lp)
     else
        lp = (struct player *)lp->queue.q_forw;
     if (&lp->queue == &Players)
     else
        lp = (struct player *)lp->queue.q_forw;
     if (&lp->queue == &Players)
-       return 0;
+       return NULL;
     return lp;
 }
 
     return lp;
 }
 
@@ -134,7 +134,7 @@ player_prev(struct player *lp)
     else
        lp = (struct player *)lp->queue.q_back;
     if (&lp->queue == &Players)
     else
        lp = (struct player *)lp->queue.q_back;
     if (&lp->queue == &Players)
-       return 0;
+       return NULL;
     return lp;
 }
 
     return lp;
 }
 
index 8013871d45f17040ecd4fe7d04a1970dcc75c2cb..379ea61a56de28c860d6169240d1fbf1f72535fe 100644 (file)
@@ -279,5 +279,5 @@ struct cmndstr player_coms[] = {
     {"work <LAND UNITS> <AMOUNT>", 1, work, C_MOD, NORM + MONEY + CAP},
     {"xdump [\"meta\"] <TYPE> [<RECORDS>]", 0, xdump, 0, VIS},
     {"zdone <y|n|c>", 0, zdon, C_MOD, NORM},
     {"work <LAND UNITS> <AMOUNT>", 1, work, C_MOD, NORM + MONEY + CAP},
     {"xdump [\"meta\"] <TYPE> [<RECORDS>]", 0, xdump, 0, VIS},
     {"zdone <y|n|c>", 0, zdon, C_MOD, NORM},
-    {0, 0, 0, 0, 0}
+    {NULL, 0, NULL, 0, 0}
 };
 };
index 28b5311c09839bbdcdbe82097cdfa196c03bb59d..58cc96ce3829fb46bbbe2f3ed1211166699e340e 100644 (file)
@@ -69,7 +69,7 @@ static struct cmndstr login_coms[] = {
     {"quit", 0, quit_cmd, 0, 0},
     {"sanc", 0, sanc_cmd, 0, 0},
     {"user name", 0, user_cmd, 0, 0},
     {"quit", 0, quit_cmd, 0, 0},
     {"sanc", 0, sanc_cmd, 0, 0},
     {"user name", 0, user_cmd, 0, 0},
-    {0, 0, 0, 0, 0}
+    {NULL, 0, NULL, 0, 0}
 };
 
 /*ARGSUSED*/
 };
 
 /*ARGSUSED*/
index 9a91173af1e2e4630b8e41cc17a9947998a9de96..46161828ab9ca0bffa35ef579defb541f7683510 100644 (file)
@@ -295,7 +295,7 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
                && pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
                continue;
            if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
                && pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
                continue;
            if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
-               || mission_pln_equip(dplp, 0, P_F, 0) < 0) {
+               || mission_pln_equip(dplp, NULL, P_F, 0) < 0) {
                emp_remque(dqp);
                free(dqp);
                continue;
                emp_remque(dqp);
                free(dqp);
                continue;
@@ -369,7 +369,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
            && pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
            continue;
        if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
            && pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
            continue;
        if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
-           || mission_pln_equip(plp, 0, P_F, 0) < 0) {
+           || mission_pln_equip(plp, NULL, P_F, 0) < 0) {
            emp_remque(qp);
            free(qp);
            continue;
            emp_remque(qp);
            free(qp);
            continue;
index 2abacbdee33d57cd2c086eaddc1ead834e9681d8..95349c517774d9074b178cdbc2f376ab9fcc3318 100644 (file)
@@ -912,7 +912,7 @@ ask_off(int combat_mode, struct combat *off, struct combat *def)
        sprintf(prompt, "Number of mil from %s (max %d) : ",
                prcom(0, off), mob_support);
     }
        sprintf(prompt, "Number of mil from %s (max %d) : ",
                prcom(0, off), mob_support);
     }
-    if ((attacking_mil = onearg(0, prompt)) < 0)
+    if ((attacking_mil = onearg(NULL, prompt)) < 0)
        abort_attack();
     if (att_abort(combat_mode, off, def))
        return 0;
        abort_attack();
     if (att_abort(combat_mode, off, def))
        return 0;
@@ -1271,7 +1271,8 @@ get_ototal(int combat_mode, struct combat *off, struct emp_qelem *olist,
     for (qp = olist->q_forw; qp != olist; qp = next) {
        next = qp->q_forw;
        llp = (struct ulist *)qp;
     for (qp = olist->q_forw; qp != olist; qp = next) {
        next = qp->q_forw;
        llp = (struct ulist *)qp;
-       if (check && !get_land(combat_mode, 0, llp->unit.land.lnd_uid, llp, 0))
+       if (check &&
+           !get_land(combat_mode, NULL, llp->unit.land.lnd_uid, llp, 0))
            continue;
        if (combat_mode == A_ATTACK) {
            w = -1;
            continue;
        if (combat_mode == A_ATTACK) {
            w = -1;
@@ -1448,7 +1449,7 @@ put_land(struct emp_qelem *list)
            emp_remque((struct emp_qelem *)llp);
            free(llp);
        } else
            emp_remque((struct emp_qelem *)llp);
            free(llp);
        } else
-           get_land(A_ATTACK, 0, llp->unit.land.lnd_uid, llp, 0);
+           get_land(A_ATTACK, NULL, llp->unit.land.lnd_uid, llp, 0);
     }
 }
 
     }
 }
 
@@ -2181,7 +2182,7 @@ take_def(int combat_mode, struct emp_qelem *list, struct combat *off,
 {
     int n;
     int occuppied = 0;
 {
     int n;
     int occuppied = 0;
-    struct ulist *llp, *delete_me = 0;
+    struct ulist *llp, *delete_me = NULL;
     char buf[1024];
     struct sctstr sect;
     struct shpstr ship;
     char buf[1024];
     struct sctstr sect;
     struct shpstr ship;
index 1e7a4a2e2b848bc3e8a3ce9f65026f5d4945d891..20a0df843c362a3f8ae2087ea90d21301f0437ab 100644 (file)
@@ -48,7 +48,7 @@ getstarg(char *input, char *prompt, char *buf)
     *buf = '\0';
     if (input == 0 || *input == 0) {
        if (getstring(prompt, buf) == 0)
     *buf = '\0';
     if (input == 0 || *input == 0) {
        if (getstring(prompt, buf) == 0)
-           return 0;
+           return NULL;
     } else {
        strcpy(buf, input);
     }
     } else {
        strcpy(buf, input);
     }
index 81e6b28f1dfcee9b6ce7ce547395ec17cd9aced9..897cc09b597a8a065b0bd5322c47fc743a4119c8 100644 (file)
@@ -254,7 +254,7 @@ adj_units(coord x, coord y, natid own)
 
     for (i = DIR_FIRST; i <= DIR_LAST; i++) {
        getsect(x + diroff[i][0], y + diroff[i][1], &sect);
 
     for (i = DIR_FIRST; i <= DIR_LAST; i++) {
        getsect(x + diroff[i][0], y + diroff[i][1], &sect);
-       if (has_units(sect.sct_x, sect.sct_y, own, 0))
+       if (has_units(sect.sct_x, sect.sct_y, own, NULL))
            return 1;
     }
     return 0;
            return 1;
     }
     return 0;
index 985a4db4025df6439df84eb9f7f8acea187cb168..bfda69e532c17c4f2c07a2b56f05094bbbaa6f96 100644 (file)
@@ -989,7 +989,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
                    pr("%s was shot and killed.\n", prland(&llp->unit.land));
                    llp->unit.land.lnd_effic = 0;
                    putland(llp->unit.land.lnd_uid, &llp->unit.land);
                    pr("%s was shot and killed.\n", prland(&llp->unit.land));
                    llp->unit.land.lnd_effic = 0;
                    putland(llp->unit.land.lnd_uid, &llp->unit.land);
-                   lnd_delete(llp, 0);
+                   lnd_delete(llp, NULL);
                }
            }
        }
                }
            }
        }
index 586300a0a17eeb80133598f21774ff936ec0a582..2c6cba992e450d9c2892493a5c10d445557482c3 100644 (file)
@@ -610,12 +610,12 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
        /* Split off the escorts at this base into e */
        divide(&escorts, &e, air->x, air->y);
 
        /* Split off the escorts at this base into e */
        divide(&escorts, &e, air->x, air->y);
 
-       mission_pln_arm(&b, air->x, air->y, 2 * md, 'p', 0, 0);
+       mission_pln_arm(&b, air->x, air->y, 2 * md, 'p', NULL, 0);
 
        if (QEMPTY(&b))
            continue;
 
 
        if (QEMPTY(&b))
            continue;
 
-       mission_pln_arm(&e, air->x, air->y, 2 * md, 'p', 0, P_F | P_ESC);
+       mission_pln_arm(&e, air->x, air->y, 2 * md, 'p', NULL, P_F | P_ESC);
 
        pp = BestAirPath(buf, air->x, air->y, x, y);
        if (CANT_HAPPEN(!pp))
 
        pp = BestAirPath(buf, air->x, air->y, x, y);
        if (CANT_HAPPEN(!pp))
index f5decdd09a177b2087a184687b335d3272c2e458..657ed03ab8b41f72b7fa78c532451bbb6367c1e2 100644 (file)
@@ -61,7 +61,7 @@ msl_equip(struct plnstr *pp, char mission)
     memset(&pl, 0, sizeof(struct plist));
     pl.pcp = plchr + pp->pln_type;
     pl.plane = *pp;
     memset(&pl, 0, sizeof(struct plist));
     pl.pcp = plchr + pp->pln_type;
     pl.plane = *pp;
-    return mission_pln_equip(&pl, 0, 0, mission);
+    return mission_pln_equip(&pl, NULL, 0, mission);
 }
 
 int
 }
 
 int
@@ -271,7 +271,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        if (pp->pln_own != sect.sct_own)
            continue;
        pcp = ip->pcp;
        if (pp->pln_own != sect.sct_own)
            continue;
        pcp = ip->pcp;
-       if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
+       if (mission_pln_equip(ip, NULL, 0, 'i') < 0) {
            emp_remque(qp);
            free(qp);
            continue;
            emp_remque(qp);
            free(qp);
            continue;
@@ -290,7 +290,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        ip = (struct plist *)qp;
        pp = &ip->plane;
        pcp = ip->pcp;
        ip = (struct plist *)qp;
        pp = &ip->plane;
        pcp = ip->pcp;
-       if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
+       if (mission_pln_equip(ip, NULL, 0, 'i') < 0) {
            emp_remque(qp);
            free(qp);
            continue;
            emp_remque(qp);
            free(qp);
            continue;
@@ -401,7 +401,7 @@ msl_launch_mindam(struct emp_qelem *list, coord x, coord y, int hardtarget,
        next = qp->q_back;
        plp = (struct plist *)qp;
 
        next = qp->q_back;
        plp = (struct plist *)qp;
 
-       if (mission_pln_equip(plp, 0, 0, 'p') >= 0) {
+       if (mission_pln_equip(plp, NULL, 0, 'p') >= 0) {
            if (msl_hit(&plp->plane,
                        hardtarget, type, news_item, snews_item,
                        whatp, x, y, victim)) {
            if (msl_hit(&plp->plane,
                        hardtarget, type, news_item, snews_item,
                        whatp, x, y, victim)) {
index 3ba199ee9b7ed78e3a501f9a72a846025977689c..79fbd1d7bd7c116a656c48311270c903d7aab735 100644 (file)
@@ -201,7 +201,7 @@ pr_wall(char *format, ...)
     va_start(ap, format);
     (void)vsprintf(buf + n, format, ap);
     va_end(ap);
     va_start(ap, format);
     (void)vsprintf(buf + n, format, ap);
     va_end(ap);
-    for (p = player_next(0); p; p = player_next(p)) {
+    for (p = player_next(NULL); p; p = player_next(p)) {
        if (p->state != PS_PLAYING)
            continue;
        pr_player(p, C_FLASH, buf);
        if (p->state != PS_PLAYING)
            continue;
        pr_player(p, C_FLASH, buf);
index 1adb7ab681c1d29b7262bc3771863ce29b6b3870..799630da436e7b18eeb968a3dad29e5cd89231f1 100644 (file)
@@ -52,7 +52,7 @@ setrel(natid us, natid them, int rel)
     char *whichway;
     int n_up = 0;
     int n_down = 0;
     char *whichway;
     int n_up = 0;
     int n_down = 0;
-    char *addendum = 0;
+    char *addendum = NULL;
     int theirrel;
 
     if (rel < AT_WAR)
     int theirrel;
 
     if (rel < AT_WAR)
index 8f372477cf24b7df2949ae4ae133a5f000ff44a7..70003f9c636a157ec6d852f10cef0d0fb0942d04 100644 (file)
@@ -423,7 +423,7 @@ most_valuable_ship(struct emp_qelem *list)
     struct emp_qelem *qp;
     struct emp_qelem *next;
     struct ulist *mlp;
     struct emp_qelem *qp;
     struct emp_qelem *next;
     struct ulist *mlp;
-    struct ulist *mvs = 0;
+    struct ulist *mvs = NULL;
 
     for (qp = list->q_back; qp != list; qp = next) {
        next = qp->q_back;
 
     for (qp = list->q_back; qp != list; qp = next) {
        next = qp->q_back;
index e65c8e09328328ba3e2a4482edd06c758575fbba..c836c5fb2639abc12fabc26d5f4549e09470b7d2 100644 (file)
@@ -147,14 +147,14 @@ unit_path(int together, struct empobj *unit, char *buf)
        return NULL;
 
     if (!sarg_xy(buf, &destx, &desty))
        return NULL;
 
     if (!sarg_xy(buf, &destx, &desty))
-       return 0;
+       return NULL;
     if (!together) {
        pr("Cannot go to a destination sector if not all starting in the same sector\n");
     if (!together) {
        pr("Cannot go to a destination sector if not all starting in the same sector\n");
-       return 0;
+       return NULL;
     }
     if (!getsect(destx, desty, &d_sect)) {
        pr("%d,%d is not a sector\n", destx, desty);
     }
     if (!getsect(destx, desty, &d_sect)) {
        pr("%d,%d is not a sector\n", destx, desty);
-       return 0;
+       return NULL;
     }
     if (unit->ef_type == EF_SHIP) {
        cp = BestShipPath(buf, unit->x, unit->y,
     }
     if (unit->ef_type == EF_SHIP) {
        cp = BestShipPath(buf, unit->x, unit->y,
@@ -162,7 +162,7 @@ unit_path(int together, struct empobj *unit, char *buf)
        if (!cp || unit->mobil <= 0) {
            pr("Can't get to '%s' right now.\n",
                xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
        if (!cp || unit->mobil <= 0) {
            pr("Can't get to '%s' right now.\n",
                xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
-           return 0;
+           return NULL;
        }
     } else {
        getsect(unit->x, unit->y, &sect);
        }
     } else {
        getsect(unit->x, unit->y, &sect);
@@ -173,7 +173,7 @@ unit_path(int together, struct empobj *unit, char *buf)
               mtype == MOB_RAIL ? "railway" : "path",
               xyas(unit->x, unit->y, player->cnum),
               xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
               mtype == MOB_RAIL ? "railway" : "path",
               xyas(unit->x, unit->y, player->cnum),
               xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
-           return 0;
+           return NULL;
        }
        pr("Using path '%s'\n", cp);
     }
        }
        pr("Using path '%s'\n", cp);
     }
index 2b7cfb49e093e4b6c2b73cb605540abfb5a3bd9c..0d925189a140e4745c083ebf06e71f98660af9b2 100644 (file)
@@ -49,7 +49,7 @@ whatitem(char *input, char *prompt)
 
     p = getstarg(input, prompt, buf);
     if (p == 0 || *p == 0)
 
     p = getstarg(input, prompt, buf);
     if (p == 0 || *p == 0)
-       return 0;
+       return NULL;
     ip = item_by_name(p);
     if (!ip)
        pr("Unrecognized item \"%c\"\n", *p);
     ip = item_by_name(p);
     if (!ip)
        pr("Unrecognized item \"%c\"\n", *p);
@@ -69,5 +69,5 @@ item_by_name(char *str)
        if (*str == ip->i_mnem)
            return ip;
     }
        if (*str == ip->i_mnem)
            return ip;
     }
-    return 0;
+    return NULL;
 }
 }
index 2853e5d5bd7cbec4889134d73e11cdd5d3340845..60ca0e9979ca2aebf8d07016ef5f8b2289125dbb 100644 (file)
@@ -47,16 +47,16 @@ nxtitemp(struct nstr_item *np)
     int selected;
 
     if (np->sel == NS_UNDEF)
     int selected;
 
     if (np->sel == NS_UNDEF)
-       return 0;
+       return NULL;
     do {
        if (np->sel == NS_LIST) {
            np->index++;
            if (np->index >= np->size)
     do {
        if (np->sel == NS_LIST) {
            np->index++;
            if (np->index >= np->size)
-               return 0;
+               return NULL;
            np->cur = np->list[np->index];
        } else if (np->sel == NS_CARGO) {
            if (np->next < 0)
            np->cur = np->list[np->index];
        } else if (np->sel == NS_CARGO) {
            if (np->next < 0)
-               return 0;
+               return NULL;
            np->cur = np->next;
            np->next = unit_cargo_next(np->type, np->next);
        } else {
            np->cur = np->next;
            np->next = unit_cargo_next(np->type, np->next);
        } else {
@@ -64,7 +64,7 @@ nxtitemp(struct nstr_item *np)
        }
        gp = ef_ptr(np->type, np->cur);
        if (!gp)
        }
        gp = ef_ptr(np->type, np->cur);
        if (!gp)
-           return 0;
+           return NULL;
 
        selected = 1;
        switch (np->sel) {
 
        selected = 1;
        switch (np->sel) {
@@ -74,7 +74,7 @@ nxtitemp(struct nstr_item *np)
            break;
        case NS_DIST:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_XY)))
            break;
        case NS_DIST:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_XY)))
-               return 0;
+               return NULL;
            if (!xyinrange(gp->x, gp->y, &np->range)) {
                selected = 0;
                break;
            if (!xyinrange(gp->x, gp->y, &np->range)) {
                selected = 0;
                break;
@@ -85,25 +85,25 @@ nxtitemp(struct nstr_item *np)
            break;
        case NS_AREA:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_XY)))
            break;
        case NS_AREA:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_XY)))
-               return 0;
+               return NULL;
            if (!xyinrange(gp->x, gp->y, &np->range))
                selected = 0;
            break;
        case NS_XY:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_XY)))
            if (!xyinrange(gp->x, gp->y, &np->range))
                selected = 0;
            break;
        case NS_XY:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_XY)))
-               return 0;
+               return NULL;
            if (xnorm(gp->x) != np->cx || ynorm(gp->y) != np->cy)
                selected = 0;
            break;
        case NS_GROUP:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_GROUP)))
            if (xnorm(gp->x) != np->cx || ynorm(gp->y) != np->cy)
                selected = 0;
            break;
        case NS_GROUP:
            if (CANT_HAPPEN(!(ef_flags(np->type) & EFF_GROUP)))
-               return 0;
+               return NULL;
            if (np->group != gp->group)
                selected = 0;
            break;
        default:
            CANT_REACH();
            if (np->group != gp->group)
                selected = 0;
            break;
        default:
            CANT_REACH();
-           return 0;
+           return NULL;
        }
        if (selected && np->ncond) {
            /* nstr_exec is expensive, so we do it last */
        }
        if (selected && np->ncond) {
            /* nstr_exec is expensive, so we do it last */
index cc3ecb1d91293614aa34ca10bbf5d17cf3e561af..9102a885edd0b5e87a3d05d7f7d5c2ac06ebb6a4 100644 (file)
@@ -99,7 +99,7 @@ do_plague(struct sctstr *sp, struct natstr *np, int etu)
        }
     }
     if (sp->sct_item[I_CIVIL] == 0 && sp->sct_item[I_MILIT] == 0
        }
     }
     if (sp->sct_item[I_CIVIL] == 0 && sp->sct_item[I_MILIT] == 0
-       && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, 0)) {
+       && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) {
        makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
        sp->sct_own = 0;
        sp->sct_oldown = 0;
        makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
        sp->sct_own = 0;
        sp->sct_oldown = 0;
index 5a1d35937da410ef72b15d145b5e8c5edd545cc4..a02fa2d04298e7bd88a8890b3e6745ccdd95ee74 100644 (file)
@@ -52,7 +52,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
        sp->sct_oldown = sp->sct_own;
     }
     if (!civ && !mil && !sp->sct_item[I_UW]
        sp->sct_oldown = sp->sct_own;
     }
     if (!civ && !mil && !sp->sct_item[I_UW]
-       && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, 0)) {
+       && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) {
        makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
        sp->sct_own = 0;
        sp->sct_oldown = 0;
        makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
        sp->sct_own = 0;
        sp->sct_oldown = 0;
index 267e5f0977b487b42fab8dca871d95f0418226f9..10f866bf49aadf5603855bcf47d151c1a98712e7 100644 (file)
@@ -352,7 +352,7 @@ guerrilla(struct sctstr *sp)
     }
   domove:
     if (move && che > 0) {
     }
   domove:
     if (move && che > 0) {
-       struct sctstr *nicest_sp = 0;
+       struct sctstr *nicest_sp = NULL;
        if (convert)
            min_mil = 999;
        else
        if (convert)
            min_mil = 999;
        else
index a1588759e872e557e5962bea9f7197d30bc011d9..ba1376de3b38af913997d6ede04d8defbb5b50e2 100644 (file)
@@ -299,7 +299,7 @@ void
 sail_ship(natid cn)
 {
     struct shpstr *sp;
 sail_ship(natid cn)
 {
     struct shpstr *sp;
-    struct fltheadstr *head = 0;
+    struct fltheadstr *head = NULL;
     struct fltheadstr *fltp;
     int n;
 
     struct fltheadstr *fltp;
     int n;
 
index 7e569a0297d9feeaa72fc2d4008ac8908862abcb..5f72fc85cfd0ba55d0ac45d3fbe1f597a3e4dd91 100644 (file)
@@ -297,7 +297,7 @@ produce_sect(int natnum, int etu, struct bp *bp, long p_sect[][2])
         * they all starved or were plagued off.
         */
        if (vec[I_CIVIL] == 0 && vec[I_MILIT] == 0 &&
         * they all starved or were plagued off.
         */
        if (vec[I_CIVIL] == 0 && vec[I_MILIT] == 0 &&
-           !has_units(sp->sct_x, sp->sct_y, sp->sct_own, 0)) {
+           !has_units(sp->sct_x, sp->sct_y, sp->sct_own, NULL)) {
            if (!player->simulation) {
                makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
                sp->sct_own = 0;
            if (!player->simulation) {
                makelost(EF_SECTOR, sp->sct_own, 0, sp->sct_x, sp->sct_y);
                sp->sct_own = 0;
index b619fb20826267a71934b81726a39466e6aa9f89..e04884ce7e6fe56e4e253b0b212c1ac596385313 100644 (file)
@@ -382,7 +382,7 @@ start_server(int flags)
     if (journal_startup() < 0)
        exit(1);
 
     if (journal_startup() < 0)
        exit(1);
 
-    empth_create(player_accept, 50 * 1024, flags, "AcceptPlayers", 0);
+    empth_create(player_accept, 50 * 1024, flags, "AcceptPlayers", NULL);
 
     market_init();
     update_init();
 
     market_init();
     update_init();
@@ -422,7 +422,7 @@ shutdwn(int sig)
     logerror("Shutdown commencing (cleaning up threads.)");
 
     play_wrlock_wanted = 1;
     logerror("Shutdown commencing (cleaning up threads.)");
 
     play_wrlock_wanted = 1;
-    for (p = player_next(0); p != 0; p = player_next(p)) {
+    for (p = player_next(NULL); p != 0; p = player_next(p)) {
        if (p->state != PS_PLAYING)
            continue;
        pr_flash(p, "Server shutting down...\n");
        if (p->state != PS_PLAYING)
            continue;
        pr_flash(p, "Server shutting down...\n");
index 75573b8df0c00d71438a56c934346545ffd6765a..cb73724f123a4dc020d04576c020748611e08e34 100644 (file)
@@ -194,7 +194,7 @@ update_run(void)
     struct player *p;
 
     play_wrlock_wanted = 1;
     struct player *p;
 
     play_wrlock_wanted = 1;
-    for (p = player_next(0); p != 0; p = player_next(p)) {
+    for (p = player_next(NULL); p != 0; p = player_next(p)) {
        if (p->state != PS_PLAYING)
            continue;
        if (p->command) {
        if (p->state != PS_PLAYING)
            continue;
        if (p->command) {