]> git.pond.sub.org Git - empserver/commitdiff
Remove a bunch of redundant casts.
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 12 Jun 2005 06:31:48 +0000 (06:31 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 12 Jun 2005 06:31:48 +0000 (06:31 +0000)
125 files changed:
src/client/ioqueue.c
src/client/queue.c
src/client/termio.c
src/lib/as/as_cache.c
src/lib/as/as_delete.c
src/lib/as/as_hash.c
src/lib/as/as_search.c
src/lib/commands/add.c
src/lib/commands/arm.c
src/lib/commands/boar.c
src/lib/commands/budg.c
src/lib/commands/buil.c
src/lib/commands/carg.c
src/lib/commands/cede.c
src/lib/commands/coas.c
src/lib/commands/cons.c
src/lib/commands/conv.c
src/lib/commands/coun.c
src/lib/commands/decl.c
src/lib/commands/drop.c
src/lib/commands/foll.c
src/lib/commands/fort.c
src/lib/commands/fuel.c
src/lib/commands/hard.c
src/lib/commands/head.c
src/lib/commands/info.c
src/lib/commands/land.c
src/lib/commands/laun.c
src/lib/commands/ldump.c
src/lib/commands/ledg.c
src/lib/commands/load.c
src/lib/commands/look.c
src/lib/commands/lost.c
src/lib/commands/lstat.c
src/lib/commands/lten.c
src/lib/commands/mfir.c
src/lib/commands/mine.c
src/lib/commands/miss.c
src/lib/commands/mobq.c
src/lib/commands/mora.c
src/lib/commands/name.c
src/lib/commands/navi.c
src/lib/commands/ndump.c
src/lib/commands/new.c
src/lib/commands/news.c
src/lib/commands/nuke.c
src/lib/commands/offe.c
src/lib/commands/orde.c
src/lib/commands/path.c
src/lib/commands/payo.c
src/lib/commands/pboa.c
src/lib/commands/pdump.c
src/lib/commands/plan.c
src/lib/commands/powe.c
src/lib/commands/pstat.c
src/lib/commands/rada.c
src/lib/commands/rang.c
src/lib/commands/rea.c
src/lib/commands/reje.c
src/lib/commands/repo.c
src/lib/commands/retr.c
src/lib/commands/rout.c
src/lib/commands/sabo.c
src/lib/commands/sail.c
src/lib/commands/scra.c
src/lib/commands/scut.c
src/lib/commands/sdump.c
src/lib/commands/sect.c
src/lib/commands/set.c
src/lib/commands/shi.c
src/lib/commands/shoo.c
src/lib/commands/skyw.c
src/lib/commands/sona.c
src/lib/commands/spy.c
src/lib/commands/sstat.c
src/lib/commands/stre.c
src/lib/commands/strv.c
src/lib/commands/supp.c
src/lib/commands/surv.c
src/lib/commands/tend.c
src/lib/commands/torp.c
src/lib/commands/trad.c
src/lib/commands/tran.c
src/lib/commands/trea.c
src/lib/commands/upgr.c
src/lib/commands/work.c
src/lib/common/bestpath.c
src/lib/common/bridgefall.c
src/lib/common/land.c
src/lib/common/maps.c
src/lib/common/path.c
src/lib/common/sectdamage.c
src/lib/empthread/ntthread.c
src/lib/empthread/pthread.c
src/lib/gen/io.c
src/lib/gen/ioqueue.c
src/lib/gen/strdup.c
src/lib/lwp/arch.c
src/lib/lwp/lwp.c
src/lib/lwp/sel.c
src/lib/lwp/sem.c
src/lib/player/accept.c
src/lib/player/login.c
src/lib/subs/aircombat.c
src/lib/subs/attsub.c
src/lib/subs/control.c
src/lib/subs/list.c
src/lib/subs/lndsub.c
src/lib/subs/mission.c
src/lib/subs/mslsub.c
src/lib/subs/plnsub.c
src/lib/subs/pr.c
src/lib/subs/radmap.c
src/lib/subs/retreat.c
src/lib/subs/satmap.c
src/lib/subs/shpsub.c
src/lib/subs/supply.c
src/lib/subs/trdsub.c
src/lib/subs/trechk.c
src/lib/update/finish.c
src/lib/update/main.c
src/lib/update/nav_ship.c
src/lib/update/sail.c
src/util/fairland.c
src/util/files.c

index 7987a78f2fb82612934662c011b45170cce69715..681857fb91b92c495b40bdc7819bc4f0a1ef2316 100644 (file)
@@ -178,7 +178,7 @@ enqueuecc(struct ioqueue *ioq, char *buf, int cc)
 {
     struct io *io;
 
-    io = (struct io *)malloc(sizeof(*io));
+    io = malloc(sizeof(*io));
     io->nbytes = cc;
     io->offset = 0;
     io->data = buf;
index 5b7c67195ed4ddc0fd52cb26e9da361c14b3add7..2347eef39d6eef4782fe3a1286d2eeab3b107f39 100644 (file)
@@ -68,7 +68,7 @@ makeqt(int nelem)
     struct qelem *qp;
     int i;
 
-    table = (struct qelem *)malloc(sizeof(*table) * nelem);
+    table = malloc(sizeof(*table) * nelem);
     for (i = 0, qp = table; i < nelem; i++, qp++)
        initque(qp);
     return table;
index 49885031eabcc495e4373ebc60c67d1cfeb9f24e..88bd1551df03357ebafbb6412f4bacdf7aa416bd 100644 (file)
@@ -133,8 +133,8 @@ termio(int fd, int sock, FILE *auxfi)
     while (p < buf + n && q < out + 4000) {
        if (*p == '\n') {
            if (tagging) {
-               tag = (struct tagstruct *)malloc(sizeof(struct tagstruct));
-               tag->item = (char *)malloc((1 + p - s) * sizeof(char));
+               tag = malloc(sizeof(struct tagstruct));
+               tag->item = malloc((1 + p - s) * sizeof(char));
                tag->next = taglist;
                taglist = tag;
                t = tag->item;
index 73a7f898f45937309b8a3389052f65040cacba5f..ca9b62cad0b464cda9e3af039736221b5d6e0a69 100644 (file)
@@ -102,7 +102,7 @@ as_add_cachepath(struct as_data *adp)
        }
     } else {
        /* We must make a new one of these */
-       from = (struct as_frompath *)malloc(sizeof(struct as_frompath));
+       from = malloc(sizeof(struct as_frompath));
        if (from == NULL)
            return;
        /* And set some stuff */
@@ -115,7 +115,7 @@ as_add_cachepath(struct as_data *adp)
     }
     if (!to) {
        /* We must make a new one */
-       to = (struct as_topath *)malloc(sizeof(struct as_topath));
+       to = malloc(sizeof(struct as_topath));
        /* We can't, sorry */
        if (to == NULL)
            return;
@@ -152,15 +152,15 @@ as_clear_cachepath(void)
                    /* Free this path */
                    as_free_path(to->path);
                    /* Free this node */
-                   free((s_char *)to);
+                   free(to);
                }
            }
            /* Now, free the list of lists */
-           free((s_char *)from->tolist);
+           free(from->tolist);
            /* Save the next pointer */
            from2 = from->next;
            /* now, free this from node */
-           free((s_char *)from);
+           free(from);
        }
     }
     /* Note we don't free the fromhead here, we just zero it.  That way,
index 39292e5fec1c7c6940b81a10a6243e65a66e5b00..f34a35df2329100ed033289542b4f2b50818c2f4 100644 (file)
@@ -50,9 +50,9 @@ as_free_queue(struct as_queue *queue)
     struct as_queue *qp, *qp2;
 
     for (qp = queue; qp; qp = qp2) {
-       free((s_char *)qp->np);
+       free(qp->np);
        qp2 = qp->next;
-       free((s_char *)qp);
+       free(qp);
     }
 }
 
@@ -66,7 +66,7 @@ as_free_path(struct as_path *pp)
 
     for (; pp; pp = pp2) {
        pp2 = pp->next;
-       free((s_char *)pp);
+       free(pp);
     }
 }
 
@@ -77,8 +77,8 @@ void
 as_delete(struct as_data *adp)
 {
     as_reset(adp);
-    free((s_char *)adp->neighbor_coords);
-    free((s_char *)adp->neighbor_nodes);
-    free((s_char *)adp->hashtab);
-    free((s_char *)adp);
+    free(adp->neighbor_coords);
+    free(adp->neighbor_nodes);
+    free(adp->hashtab);
+    free(adp);
 }
index d9a47f2efef82fa4a4721febe8ea808b44fffcf1..9311dfc44bbeeb2c92134d18d1ec41f61242c496 100644 (file)
@@ -74,7 +74,7 @@ as_free_hashtab(struct as_data *adp)
     for (i = 0; i < adp->hashsize; i++) {
        for (hp = adp->hashtab[i]; hp; hp = hp2) {
            hp2 = hp->next;
-           free((char *)hp);
+           free(hp);
        }
        adp->hashtab[i] = NULL;
     }
index ba6188810b50461822dcd68d6aaf0a0e53b03a32..f59e025a69857b32c3fe6671d9d40a1ea46b6e9c 100644 (file)
@@ -135,7 +135,7 @@ as_makepath(struct as_data *adp)
     struct as_node *np;
 
     for (np = adp->head->np; np; np = np->back) {
-       pp = (struct as_path *)malloc(sizeof(struct as_path));
+       pp = malloc(sizeof(struct as_path));
        pp->c = np->c;
        pp->next = adp->path;
        adp->path = pp;
index 05de212227f37fd873621735299a039209b68d76..aa2df5c7d16a03c0cd6437f88ee5e7a04fcaa609 100644 (file)
@@ -143,7 +143,7 @@ add(void)
     if (p == 0)
        return RET_OK;
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == coun) {
            makelost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
                     land.lnd_y);
index 32b486890265b6c1cb663b64947f4fed1bc9c19b..a411c588727095d98e7a9fe5815dbdb2e79eba0d 100644 (file)
@@ -101,7 +101,7 @@ arm(void)
        nuketype = i;
        nukenum = -1;
        snxtitem_all(&ni, EF_NUKE);
-       while (nxtitem(&ni, (s_char *)&nuke)) {
+       while (nxtitem(&ni, &nuke)) {
            if (nuke.nuk_own != player->cnum)
                continue;
            if (nuke.nuk_x != pl.pln_x || nuke.nuk_y != pl.pln_y)
index d4e7f5438285e0b9e779a941ed8b762922b430a6..10cd856819df4e4fbe1ff86893a7670234f9ccdb 100644 (file)
@@ -94,7 +94,7 @@ boar(void)
            /* Look for land units with mobility */
            snxtitem_xy(&ni, EF_LAND, off->x, off->y);
            foundland = 0;
-           while (nxtitem(&ni, (s_char *)&land)) {
+           while (nxtitem(&ni, &land)) {
                if (land.lnd_own != player->cnum)
                    continue;
                if (land.lnd_ship >= 0)
index e615a5adf488cee8b0f5fac0a6d0e81f9b8f99a2..406bb34fd3c34352638acc6fc47ac1ac9e2ee459 100644 (file)
@@ -241,7 +241,7 @@ calc_all(long p_sect[][2],
     *planes = *pbuild = *npbuild = *pmaint = 0;
     
     np = getnatp(player->cnum);
-    bp = (int *)calloc(WORLD_X * WORLD_Y * 8, sizeof(int));
+    bp = calloc(WORLD_X * WORLD_Y * 8, sizeof(int));
     for (n = 0; NULL != (sp = getsectid(n)); n++) {
        fill_update_array(bp, sp);
        if (sp->sct_own == player->cnum) {
index 86e507cd1324dec8acd679f752fb24c1c0fe743a..7e40e4bffe82e7547d5aa53c98fed0409685ca06 100644 (file)
@@ -387,7 +387,7 @@ build_ship(struct sctstr *sp, struct mchrstr *mp,
     player->dolcost += cost;
     cash -= cost;
     snxtitem_all(&nstr, EF_SHIP);
-    while (nxtitem(&nstr, (s_char *)&ship)) {
+    while (nxtitem(&nstr, &ship)) {
        if (ship.shp_own == 0) {
            freeship++;
            break;
@@ -527,7 +527,7 @@ build_land(struct sctstr *sp, struct lchrstr *lp,
     player->dolcost += cost;
     cash -= cost;
     snxtitem_all(&nstr, EF_LAND);
-    while (nxtitem(&nstr, (s_char *)&land)) {
+    while (nxtitem(&nstr, &land)) {
        if (land.lnd_own == 0) {
            freeland++;
            break;
@@ -848,7 +848,7 @@ build_plane(struct sctstr *sp, struct plchrstr *pp,
     cash -= cost;
     snxtitem_all(&nstr, EF_PLANE);
     freeplane = 0;
-    while (nxtitem(&nstr, (s_char *)&plane)) {
+    while (nxtitem(&nstr, &plane)) {
        if (plane.pln_own == 0) {
            freeplane++;
            break;
index 8fd4297bfeba1c9349b42432b17083b489d36d19..46dca5ae4ec1e97efd70d9c004a450f1886bbbd8 100644 (file)
@@ -51,7 +51,7 @@ carg(void)
     if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
        return RET_SYN;
     nships = 0;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (ship.shp_own == 0)
            continue;
        if ((player->cnum != ship.shp_own) && !player->god)
@@ -104,7 +104,7 @@ lcarg(void)
     if (!snxtitem(&ni, EF_LAND, player->argp[1]))
        return RET_SYN;
     nunits = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!land.lnd_own)
            continue;
        if ((player->cnum != land.lnd_own) && !player->god)
index 861cc1aae9d4864ee735da660c1166183add78d4..7e882554a8a7cfe80194e057dc2d7b864d6f5409 100644 (file)
@@ -158,7 +158,7 @@ cede_sect(struct nstr_sect *ns, natid to)
                bad = 0;
        }
        snxtitem_all(&ni, EF_SHIP);
-       while (nxtitem(&ni, (s_char *)&ship)) {
+       while (nxtitem(&ni, &ship)) {
            if ((ship.shp_own == to) &&
                ((ship.shp_x == sect.sct_x) && (ship.shp_y == sect.sct_y)))
                bad = 0;
@@ -300,14 +300,14 @@ cede_ship(struct nstr_item *ni, natid to)
     int nships = 0;
     int bad = 0;
 
-    while (nxtitem(ni, (s_char *)&ship)) {
+    while (nxtitem(ni, &ship)) {
 
        if (!player->owner || ship.shp_own == 0)
            continue;
 
        bad = 1;
        snxtitem_xy(&tni, EF_SHIP, ship.shp_x, ship.shp_y);
-       while (nxtitem(&tni, (s_char *)&tship) && bad)
+       while (nxtitem(&tni, &tship) && bad)
            if (tship.shp_own == to)
                bad = 0;
 
index cf2df2afd5338e55d9dcbcf0cea0c311d357db12..814e8b023de48c3128f4e3998a1043d77e55f8c1 100644 (file)
@@ -76,9 +76,9 @@ coas(void)
        return RET_SYN;
     for (i = 0; i < TSIZE; i++)
        list[i] = 0;
-    cp = (struct coast *)malloc(sizeof(*cp));
+    cp = malloc(sizeof(*cp));
     snxtitem_all(&ni, EF_SHIP);
-    while (nxtitem(&ni, (s_char *)&cp->c_shp)) {
+    while (nxtitem(&ni, &cp->c_shp)) {
        if (cp->c_shp.shp_own == 0 || cp->c_shp.shp_own == player->cnum)
            continue;
        /*
@@ -94,11 +94,11 @@ coas(void)
        cp->c_number = i;
        cp->c_next = list[n];
        list[n] = cp;
-       cp = (struct coast *)malloc(sizeof(*cp));
+       cp = malloc(sizeof(*cp));
        nship++;
     }
     /* get that last one! */
-    free((s_char *)cp);
+    free(cp);
     pr("- = [ Coastwatch report for %s ] = -\n", cname(player->cnum));
     pr("  Country            Ship          Location\n");
     tech = tfact(player->cnum, 1.0);
@@ -134,7 +134,7 @@ coas(void)
     for (i = 0; i < TSIZE; i++) {
        while (NULL != (cp = list[i])) {
            list[i] = cp->c_next;
-           free((s_char *)cp);
+           free(cp);
        }
     }
     return RET_OK;
@@ -154,7 +154,7 @@ showship(struct coast **cpp, int x, int y)
     do {
        /* we delete it, we free it. */
        if (todelete) {
-           free((s_char *)todelete);
+           free(todelete);
            todelete = 0;
        }
        if (cp->c_shp.shp_x != x || cp->c_shp.shp_y != y) {
@@ -173,6 +173,6 @@ showship(struct coast **cpp, int x, int y)
     } while (NULL != (cp = cp->c_next));
     /* check that last one! */
     if (todelete)
-       free((s_char *)todelete);
+       free(todelete);
     return (nship);
 }
index 870031f670186c4add421eb13b7c8abadf4843e8..51292f4bb25ce4c81a2c96b3c63775d9ec97e06c 100644 (file)
@@ -218,7 +218,7 @@ loan_accept(struct ltcomstr *ltcp)
     }
     /* check to see if a loan already exists */
     snxtitem_all(&nstr, EF_LOAN);
-    while (nxtitem(&nstr, (s_char *)&loan)) {
+    while (nxtitem(&nstr, &loan)) {
        if (loan.l_status == LS_SIGNED && loan.l_lonee == lp->l_loner
            && (loan.l_loner == lp->l_lonee)) {
            pr("He already owes you money - make him repay his loan!\n");
@@ -240,7 +240,7 @@ loan_accept(struct ltcomstr *ltcp)
     (void)time(&lp->l_lastpay);
     lp->l_duedate = lp->l_ldur * 86400 + lp->l_lastpay;
     lp->l_status = LS_SIGNED;
-    if (!putloan(ltcp->num, (s_char *)lp)) {
+    if (!putloan(ltcp->num, lp)) {
        pr("Problem writing lp->to disk; get help!\n");
        return RET_FAIL;
     }
index 4efa08328311ed514ea7d43fdbf4d5ca92b0b545..b7929db7ff3a2e00fc45bdfe3894a4c61fbf9bf7 100644 (file)
@@ -97,7 +97,7 @@ do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
         * count.
         */
        snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
-       while (nxtitem(&ni, (s_char *)&land)) {
+       while (nxtitem(&ni, &land)) {
            mil += lnd_getmil(&land);
 /*                     mil += (lnd_getmil(&land) *
                                ((double)land.lnd_effic/100.0));*/
index 633b524b09dedec86933bd80ae8a86232618521c..96f643f8e3debd06e4d5877826d4226dc644e65c 100644 (file)
@@ -57,7 +57,7 @@ coun(void)
     if (!snxtitem(&ni, EF_NATION, player->argp[1]))
        return RET_SYN;
     first = 1;
-    while (nxtitem(&ni, (s_char *)&nat)) {
+    while (nxtitem(&ni, &nat)) {
        if ((nat.nat_stat & STAT_INUSE) == 0)
            continue;
        if (((nat.nat_stat & GOD) != GOD) && !player->god)
index 82f58ef5400566eecbe472bd0b88f63250efc34a..8816de8fcc5bbf701b5945bd260e69d5aee903f8 100644 (file)
@@ -99,7 +99,7 @@ decl(void)
     }
 
     natp = getnatp(who);
-    while (nxtitem(&ni, (s_char *)&nat)) {
+    while (nxtitem(&ni, &nat)) {
        if (!(nat.nat_stat & STAT_INUSE))
            continue;
        if (player->cnum == (natid)ni.cur)
index 7ffd22d315a03c25d0692285baf1273ef5e7cda2..3fdf7206fb3339c996c1ce892bfbc471f3fc2636 100644 (file)
@@ -148,7 +148,7 @@ drop(void)
            && ip->i_vtype == I_SHELL)
            pln_mine(&bomb_list, &target);
        else
-           pln_dropoff(&bomb_list, ip, tx, ty, (s_char *)&target, EF_SECTOR);
+           pln_dropoff(&bomb_list, ip, tx, ty, &target, EF_SECTOR);
     }
     pln_put(&bomb_list);
     pln_put(&esc_list);
index d46d56a495685012596f26e5fa4147027d4175e1..99f35345d7af9adbd88f2f7f0d6faaf1ef558a8a 100644 (file)
@@ -72,7 +72,7 @@ foll(void)
     }
     x = ship.shp_x;
     y = ship.shp_y;
-    while (nxtitem(&nstr, (s_char *)&ship)) {
+    while (nxtitem(&nstr, &ship)) {
        if (!player->owner)
            continue;
        if (ship.shp_x != x || ship.shp_y != y) {
index d201f6290fd0849e0617d6586aa3653166247913..433b4ba815cd8482e227ea582b41d45a11c0f295 100644 (file)
@@ -59,7 +59,7 @@ fort(void)
     if (fort_amt > land_mob_max)
        fort_amt = land_mob_max;
     nunits = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
index d3febff171bcdf79ee591a3f841d1731a5bba84a..5ddc7daa72e708ae98b4251829e5bf476fa06d90 100644 (file)
@@ -102,7 +102,7 @@ fuel(void)
        return RET_FAIL;
     }
 
-    while (nxtitem(&ni, (s_char *)&item)) {
+    while (nxtitem(&ni, &item)) {
        fueled = 0;
        if (type == EF_SHIP) {
            if (item.ship.shp_own != player->cnum) {
@@ -222,7 +222,7 @@ fuel(void)
                if (!check_ship_ok(&item.ship))
                    continue;
 
-               if (!nxtitem(&tender, (s_char *)&item2))
+               if (!nxtitem(&tender, &item2))
                    continue;
 
                if (!(mchr[(int)item2.ship.shp_type].m_flags & M_OILER)) {
@@ -384,7 +384,7 @@ fuel(void)
                if (!check_land_ok(&item.land))
                    continue;
 
-               if (!nxtitem(&ltender, (s_char *)&item2))
+               if (!nxtitem(&ltender, &item2))
                    continue;
 
                if (!(lchr[(int)item2.land.lnd_type].l_flags & L_SUPPLY)) {
index ff0577a26f5821f74ba85dcdab2f10495672100b..367f8a9a65caa1507cd0ba193eba1fe4840b05e0 100644 (file)
@@ -71,7 +71,7 @@ hard(void)
        return RET_SYN;
     natp = getnatp(player->cnum);
     cash = natp->nat_money;
-    while (nxtitem(&ni, (s_char *)&pln)) {
+    while (nxtitem(&ni, &pln)) {
        if (!player->owner)
            continue;
        pcp = &plchr[(int)pln.pln_type];
index 296df49b9c834e7d335e561b5cf6be05f1253cc6..0f29fdbdc7cdadf0210bb1e48e4c6377dcf8dd4b 100644 (file)
@@ -93,7 +93,7 @@ head(void)
     memset(hist, 0, sizeof(hist));
     snxtitem_all(&nstr, EF_NEWS);
     maxcnum = 0;
-    while (nxtitem(&nstr, (s_char *)&news)) {
+    while (nxtitem(&nstr, &news)) {
        news_age = now - news.nws_when;
        if (news_age > news_per)
            continue;
index e171b7ec654749945870fcbde32574f906bf4c84..c12c27ccf3e06c022b6a52460ff1978e28db4888 100644 (file)
@@ -199,9 +199,9 @@ apro(void)
        return RET_SYS;
     }
 
-    fbuf = (s_char *)malloc(256);
-    lbuf = (s_char *)malloc(256);
-    lbp = (s_char *)malloc(256);
+    fbuf = malloc(256);
+    lbuf = malloc(256);
+    lbp = malloc(256);
 
     /*
      *  lower case search string into lbp
@@ -434,9 +434,9 @@ apro(void)
        return RET_SYS;
     }
 
-    fbuf = (s_char *)malloc(256);
-    lbuf = (s_char *)malloc(256);
-    lbp = (s_char *)malloc(256);
+    fbuf = malloc(256);
+    lbuf = malloc(256);
+    lbp = malloc(256);
 
     /*
      *  lower case search string into lbp
index 22de5ae59d9a1593ee40ee0affd42c9bad1cd8a2..5469c3ca86fe0423b310d7cee75762c0757ce898 100644 (file)
@@ -51,7 +51,7 @@ land(void)
        return RET_SYN;
 
     nunits = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (!player->owner && !player->god)
index 6e3435bacec3263eee2ddcaf7fd6d01df0cfc15d..c7da7db70bc2438ffe8822cf501eb22f1390e03b 100644 (file)
@@ -70,7 +70,7 @@ laun(void)
 
     if (!snxtitem(&nstr, EF_PLANE, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&nstr, (s_char *)&plane)) {
+    while (nxtitem(&nstr, &plane)) {
        if (plane.pln_own != player->cnum)
            continue;
        pcp = &plchr[(int)plane.pln_type];
index b38ed18bf8094e9a26d976049981f02164e8c819..61466920b89ea13218b03f262d4c56788aa213f9 100644 (file)
@@ -289,7 +289,7 @@ ldump(void)
     pr("\n");
 
     np = getnatp(player->cnum);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (!player->owner && !player->god)
index 61e8498950ad5174d89ab8000b834d619bed5968..938c05fdf070bec409a30e7d060c9ae623ec195e 100644 (file)
@@ -56,7 +56,7 @@ ledg(void)
        return RET_SYN;
     pr("\n... %s Ledger ...\n", cname(player->cnum));
     nloan = 0;
-    while (nxtitem(&nstr, (s_char *)&loan)) {
+    while (nxtitem(&nstr, &loan)) {
        if (disloan(nstr.cur, &loan) > 0)
            nloan++;
     }
index fc09e5627891c094ebb525dfb988508ef3a093a7..ead2aa64a2c6008b805707f35514b76297855e31 100644 (file)
@@ -112,7 +112,7 @@ load(void)
     load_unload = **player->argp == 'l' ? LOAD : UNLOAD;
 
     nships = 0;
-    while (nxtitem(&nbst, (s_char *)&ship)) {
+    while (nxtitem(&nbst, &ship)) {
        if (!ship.shp_own)
            continue;
        if (!player->owner && (load_unload == UNLOAD)) {
@@ -250,7 +250,7 @@ lload(void)
     load_unload = *(*player->argp + 1) == 'l' ? LOAD : UNLOAD;
 
     nunits = 0;
-    while (nxtitem(&nbst, (s_char *)&land)) {
+    while (nxtitem(&nbst, &land)) {
        if (land.lnd_own == 0)
            continue;
 
@@ -402,7 +402,7 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
     if (p && *p)
        noisy &= isdigit(*p);
 
-    while (nxtitem(&ni, (s_char *)&pln)) {
+    while (nxtitem(&ni, &pln)) {
        if (pln.pln_own != player->cnum)
            continue;
        if (!(plchr[(int)pln.pln_type].pl_flags & P_L)
@@ -547,7 +547,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
     if (p && *p)
        noisy &= isdigit(*p);
 
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own != player->cnum)
            continue;
 
@@ -656,7 +656,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
                pr("WARNING: %s is out of supply!\n", prland(&land));
            putship(sp->shp_uid, sp);
            snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
-           while (nxtitem(&pni, (s_char *)&plane)) {
+           while (nxtitem(&pni, &plane)) {
                if (plane.pln_flags & PLN_LAUNCHED)
                    continue;
                if (plane.pln_land != land.lnd_uid)
@@ -698,7 +698,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
               they are quietly unloaded too. */
            if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
                snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
-               while (nxtitem(&pni, (s_char *)&plane)) {
+               while (nxtitem(&pni, &plane)) {
                    if (plane.pln_flags & PLN_LAUNCHED)
                        continue;
                    if (plane.pln_land != land.lnd_uid)
@@ -857,7 +857,7 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
        return 0;
     }
 
-    while (nxtitem(&ni, (s_char *)&pln)) {
+    while (nxtitem(&ni, &pln)) {
        if (pln.pln_own != player->cnum)
            continue;
 
@@ -1059,7 +1059,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
     if (p && *p)
        noisy &= isdigit(*p);
 
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
 
        if (land.lnd_own != player->cnum)
            continue;
@@ -1136,7 +1136,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
                pr("WARNING: %s is out of supply!\n", prland(&land));
            putland(lp->lnd_uid, lp);
            snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
-           while (nxtitem(&pni, (s_char *)&plane)) {
+           while (nxtitem(&pni, &plane)) {
                if (plane.pln_flags & PLN_LAUNCHED)
                    continue;
                if (plane.pln_land != land.lnd_uid)
@@ -1168,7 +1168,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
            putland(land.lnd_uid, &land);
            putland(lp->lnd_uid, lp);
            snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
-           while (nxtitem(&pni, (s_char *)&plane)) {
+           while (nxtitem(&pni, &plane)) {
                if (plane.pln_flags & PLN_LAUNCHED)
                    continue;
                if (plane.pln_land != land.lnd_uid)
index 579c8f4edb04183fe348675780e5f94d878bad8d..5d2e8d97d8e6afc5fd23e4f24f9b9ba8c0903022 100644 (file)
@@ -63,13 +63,13 @@ look(void)
 
     if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
        return RET_SYN;
-    if ((bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
+    if ((bitmap = malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
        logerror("malloc failed in look\n");
        pr("Memory error.  Tell the deity.\n");
        return RET_FAIL;
     }
     memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
-    while (nxtitem(&ni, (s_char *)&myship)) {
+    while (nxtitem(&ni, &myship)) {
        if (!player->owner)
            continue;
        look_ship(&myship);
@@ -107,7 +107,7 @@ look(void)
     }
     if (changed)
        writemap(player->cnum);
-    free((s_char *)bitmap);
+    free(bitmap);
     return RET_OK;
 }
 
@@ -188,13 +188,13 @@ llook(void)
 
     if (!snxtitem(&ni, EF_LAND, player->argp[1]))
        return RET_SYN;
-    if ((bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
+    if ((bitmap = malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
        logerror("malloc failed in llook\n");
        pr("Memory error.  Tell the deity.\n");
        return RET_FAIL;
     }
     memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
-    while (nxtitem(&ni, (s_char *)&myland)) {
+    while (nxtitem(&ni, &myland)) {
        if (!player->owner)
            continue;
        if (myland.lnd_ship >= 0)
@@ -241,7 +241,7 @@ llook(void)
     }
     if (changed)
        writemap(player->cnum);
-    free((s_char *)bitmap);
+    free(bitmap);
     return RET_OK;
 }
 
index e1d99e56ce806b05f43499e4c7e30bdc7ad9bf54..e6740d372637384ccb759a1e6c763fb74e03b6cd 100644 (file)
@@ -60,7 +60,7 @@ lost(void)
     if (player->god)
        pr("owner ");
     pr("type id x y timestamp\n");
-    while (nxtitem(&ni, (s_char *)&lost)) {
+    while (nxtitem(&ni, &lost)) {
        if (lost.lost_owner == 0)
            continue;
        if (lost.lost_owner != player->cnum && !player->god)
index 75900f582f3594e90ae8c8a674717c5dd2c0994a..b18c663021235a2605ca8cc92519be93f8bf3119 100644 (file)
@@ -49,7 +49,7 @@ lsta(void)
        return RET_SYN;
 
     nunits = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
index bbce046120c587cd7da5393200eb4d004479633f..8fd2d5fe6e1d8c83edfc5c00a63fca40e3128142 100644 (file)
@@ -74,7 +74,7 @@ ltend(void)
     if (!snxtitem(&tenders, EF_SHIP,
                  getstarg(player->argp[2], "Tender(s)? ", buf)))
        return RET_SYN;
-    while (nxtitem(&tenders, (s_char *)&tender)) {
+    while (nxtitem(&tenders, &tender)) {
        if (!player->owner)
            continue;
        if ((p =
@@ -103,7 +103,7 @@ ltend(void)
        if (!check_ship_ok(&tender))
            return RET_FAIL;
        total = 0;
-       while (nxtitem(&targets, (s_char *)&target)) {
+       while (nxtitem(&targets, &target)) {
            if (!player->owner)
                continue;
 
index 96e8e3a5766dfb87d14a8d2d5f4473e5c604f8e2..8fbcba828e4f9af39c233f64f39e6f7af1c6b2b9 100644 (file)
@@ -158,7 +158,7 @@ multifire(void)
        pr("Fire aborted.\n");
        return RET_OK;
     }
-    while (nxtitem(&nbst, (s_char *)&item)) {
+    while (nxtitem(&nbst, &item)) {
        attacker = orig_attacker;
        if (attacker == targ_unit) {
            if (!getland(item.land.lnd_uid, &fland))
@@ -674,7 +674,7 @@ defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
        (dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
        if (nfiring > *nd)
            *nd = nfiring;
-       fp = (struct flist *)malloc(sizeof(struct flist));
+       fp = malloc(sizeof(struct flist));
        memset(fp, 0, sizeof(struct flist));
        fp->defdam = dam;
        fp->victim = vict;
@@ -742,7 +742,7 @@ do_defdam(struct emp_qelem *list, double odds)
                   xyas(fp->x, fp->y, vict), dam);
        }
        emp_remque(&fp->queue);
-       free((s_char *)fp);
+       free(fp);
     }
 }
 
@@ -813,7 +813,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
                continue;
 
            (*nfiring)++;
-           fp = (struct flist *)malloc(sizeof(struct flist));
+           fp = malloc(sizeof(struct flist));
            memset(fp, 0, sizeof(struct flist));
            fp->type = targ_ship;
            fp->uid = ship.shp_uid;
@@ -844,7 +844,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
            if (nshot == 0)
                continue;
            (*nfiring)++;
-           fp = (struct flist *)malloc(sizeof(struct flist));
+           fp = malloc(sizeof(struct flist));
            memset(fp, 0, sizeof(struct flist));
            fp->type = targ_ship;
            fp->uid = ship.shp_uid;
@@ -897,7 +897,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
                                land.lnd_ammo, shell);
 
        (*nfiring)++;
-       fp = (struct flist *)malloc(sizeof(struct flist));
+       fp = malloc(sizeof(struct flist));
        memset(fp, 0, sizeof(struct flist));
        fp->type = targ_unit;
        fp->uid = land.lnd_uid;
@@ -950,7 +950,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
            if (gun == 0 || firing.sct_item[I_MILIT] < 5 || shell == 0)
                continue;
            (*nfiring)++;
-           fp = (struct flist *)malloc(sizeof(struct flist));
+           fp = malloc(sizeof(struct flist));
            memset(fp, 0, sizeof(struct flist));
            fp->x = firing.sct_x;
            fp->y = firing.sct_y;
@@ -1021,7 +1021,7 @@ use_ammo(struct emp_qelem *list)
            putland(land.lnd_uid, &land);
 
        emp_remque(&fp->queue);
-       free((s_char *)fp);
+       free(fp);
     }
 
 }
index ba58408d463a82935695986c6e576bd4b7ff0b93..b01618e79cc7f985efc2c82966a0301a83a4ef82 100644 (file)
@@ -62,7 +62,7 @@ mine(void)
                   "Drop how many mines from each ship?  ");
     if (mines <= 0)
        return RET_SYN;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner)
            continue;
        mp = &mchr[(int)ship.shp_type];
@@ -107,7 +107,7 @@ landmine(void)
 
     if (!snxtitem(&ni, EF_LAND, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner)
            continue;
        lp = &lchr[(int)land.lnd_type];
index fad95990af11baeda5a946bb6bdb0574ac0d4c0c..9dfb982ade14be93874f5c6b3083382fceab9f0c 100644 (file)
@@ -190,7 +190,7 @@ mission(void)
 
     size = max(sizeof(struct lndstr), sizeof(struct plnstr));
     size = max(size, sizeof(struct shpstr));
-    block = (s_char *)malloc(size);
+    block = malloc(size);
     switch (type) {
     case EF_SHIP:
        mobmax = ship_mob_max;
index 739826b7bd5b0e7859b26cf26111de645ff99724..03d2fee9939d2c686b6ffdbbb05f580c77d3c4d9 100644 (file)
@@ -72,7 +72,7 @@ mobq(void)
            pr("warning: %d less than optimal\n", mobquota);
        }
     }
-    while (nxtitem(&nstr, (s_char *)&ship)) {
+    while (nxtitem(&nstr, &ship)) {
        if (!player->owner)
            continue;
        if (!oldmq)
index 0c8ed8382ee53cd6c60d52daf04b97e1e4a7490c..0f94cda37d193aff23d68628aea9b7ac95e47df1 100644 (file)
@@ -54,7 +54,7 @@ morale(void)
 
     if (!snxtitem(&np, EF_LAND, player->argp[1]))
        return RET_SYN;
-    while (!player->aborted && nxtitem(&np, (s_char *)&land)) {
+    while (!player->aborted && nxtitem(&np, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        natp = getnatp(land.lnd_own);
index 25175415b560b146272ef0a7c845ac270dd2ce6a..8a01326dbce92316080bf9d6dd61f1a5a642c78f 100644 (file)
@@ -57,7 +57,7 @@ name(void)
     }
     if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&nb, (s_char *)&ship)) {
+    while (nxtitem(&nb, &ship)) {
        if (!player->owner)
            continue;
        p = getstarg(player->argp[2], "Name? ", buf);
index 022f27c8df8b562e1203f80f82b3ffb96b2cd8cc..61adf5e3a489d3928747a5a0fe42b72d9fbafcd8 100644 (file)
@@ -237,20 +237,19 @@ nav_map(int x, int y, int show_designations)
     if (!snxtsct(&ns, what))
        return RET_FAIL;
     if (!wmapbuf)
-       wmapbuf =
-           (s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
     if (!wmap) {
-       wmap = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       wmap = malloc(WORLD_Y * sizeof(s_char *));
        if (wmap && wmapbuf) {
            for (i = 0; i < WORLD_Y; i++)
                wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
        } else if (wmap) {
-           free((s_char *)wmap);
+           free(wmap);
            wmap = (s_char **)0;
        }
     }
     if (!bitmap)
-       bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8);
+       bitmap = malloc((WORLD_X * WORLD_Y) / 8);
     if (!wmapbuf || !wmap || !bitmap) {
        pr("Memory error, tell the deity.\n");
        logerror("malloc failed in navi\n");
index 10e7b6b62446f84595362caf785595a5d00af68a..ddd36aef692ddc884402150c7e2a129649f2a207 100644 (file)
@@ -59,7 +59,7 @@ ndump(void)
        pr("own ");
     pr("id x y num type\n");
     nnukes = 0;
-    while (nxtitem(&nstr, (s_char *)&nuk)) {
+    while (nxtitem(&nstr, &nuk)) {
        if (!player->god && !player->owner)
            continue;
        if (nuk.nuk_own == 0)
index 53558f3adfb662a19797ebb58a2d8dfbed17a2d8..8a792716267a7112a92d1cb2f2b22c9754fc1e17 100644 (file)
@@ -229,14 +229,14 @@ isok(int x, int y)
 
     nmin = ngold = noil = nur = 0;
     navail = nfree = nowned = 0;
-    if ((map = (s_char *)malloc((WORLD_X * WORLD_Y) / 2)) == 0) {
+    if ((map = malloc((WORLD_X * WORLD_Y) / 2)) == 0) {
        logerror("malloc failed in isok\n");
        pr("Memory error.  Tell the deity.\n");
        return 0;
     }
     memset(map, 0, (WORLD_X * WORLD_Y) / 2);
     ok(map, x, y);
-    free((s_char *)map);
+    free(map);
     if (nfree < 5)
        return 0;
     pr("Cap at %s; owned sectors: %d, free sectors: %d, avail: %d\n",
@@ -261,7 +261,7 @@ ok(s_char *map, int x, int y)
     id = sctoff(x, y);
     if (map[id])
        return;
-    if (!ef_read(EF_SECTOR, id, (s_char *)&sect))
+    if (!ef_read(EF_SECTOR, id, &sect))
        return;
     if (sect.sct_type == SCT_WATER || sect.sct_type == SCT_BSPAN)
        return;
@@ -302,7 +302,7 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
     natp = getnatp(own);
 
     snxtitem_all(&nstr, EF_LAND);
-    while (nxtitem(&nstr, (s_char *)&land)) {
+    while (nxtitem(&nstr, &land)) {
        if (land.lnd_own == 0) {
            extend = 0;
            break;
index bd440bd24b4fcdbf4a49bbb6569b924d31d34ad9..830188b77643c094a77c94d3f349689853b575eb 100644 (file)
@@ -89,7 +89,7 @@ news(void)
                then = now - days(3);
 */
     pr("\nThe details of Empire news since %s", ctime(&then));
-    while (nxtitem(&nstr, (s_char *)&nws)) {
+    while (nxtitem(&nstr, &nws)) {
        if (nws.nws_when < then)
            continue;
        if (opt_HIDDEN) {
@@ -106,7 +106,7 @@ news(void)
            continue;
        pr("\n\t ===  %s  ===\n", page_headings[page]);
        snxtitem_rewind(&nstr);
-       while (nxtitem(&nstr, (s_char *)&nws)) {
+       while (nxtitem(&nstr, &nws)) {
            if (rpt[(int)nws.nws_vrb].r_newspage != page)
                continue;
            if (nws.nws_when < then)
index 7a9a76b13f2909aeda269b1da31caa6376303f65..07a8212652473c7d0335dbf1e9add75c47410804 100644 (file)
@@ -55,7 +55,7 @@ nuke(void)
     if (!snxtitem(&nstr, EF_NUKE, player->argp[1]))
        return RET_SYN;
 
-    while (nxtitem(&nstr, (s_char *)&nuk)) {
+    while (nxtitem(&nstr, &nuk)) {
        if (!player->god && !player->owner)
            continue;
        if (nuk.nuk_own == 0)
index 3b8589b99639a2abf5a5ce8257f62bbf40da7d20..1c3abed85063647c0d2cdcca4ce42923266de562 100644 (file)
@@ -135,7 +135,7 @@ do_treaty(void)
     }
     (void)time(&now);
     snxtitem_all(&nstr, EF_TREATY);
-    while (nxtitem(&nstr, (s_char *)&trty)) {
+    while (nxtitem(&nstr, &trty)) {
        if (trty.trt_status == TS_FREE) {
            break;
        }
@@ -212,7 +212,7 @@ do_loan(void)
     if (irate < 5)
        return RET_FAIL;
     snxtitem_all(&nstr, EF_LOAN);
-    while (nxtitem(&nstr, (s_char *)&loan)) {
+    while (nxtitem(&nstr, &loan)) {
        if ((loan.l_status == LS_SIGNED) && (loan.l_lonee == player->cnum)
            && (loan.l_loner == recipient)) {
            pr("You already owe HIM money - how about repaying your loan?\n");
@@ -220,7 +220,7 @@ do_loan(void)
        }
     }
     snxtitem_all(&nstr, EF_LOAN);
-    while (nxtitem(&nstr, (s_char *)&loan)) {
+    while (nxtitem(&nstr, &loan)) {
        if (loan.l_status == LS_FREE)
            break;
     }
index ad0dba7e7f429bc7c9a35dbe276afd0cf2bf546a..c253294bb9b2091eae65f1c9e64bd21984a5b8d8 100644 (file)
@@ -83,7 +83,7 @@ orde(void)
 
     if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
        return RET_SYN;
-    while (!player->aborted && nxtitem(&nb, (s_char *)(&ship))) {
+    while (!player->aborted && nxtitem(&nb, (&ship))) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
@@ -370,7 +370,7 @@ qorde(void)
 
     if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&nb, (s_char *)(&ship))) {
+    while (nxtitem(&nb, (&ship))) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
@@ -444,7 +444,7 @@ sorde(void)
 
     if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&nb, (s_char *)(&ship))) {
+    while (nxtitem(&nb, (&ship))) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
index c18fe0f605bdcf92d0f662c546ceb6c0dd112acf..9748a0cef3e6bead045bc5f0ed757138ec61ceb3 100644 (file)
@@ -80,15 +80,14 @@ path(void)
        return RET_FAIL;
     }
     if (!mapbuf)
-       mapbuf =
-           (s_char *)malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
+       mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
     if (!map) {
-       map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
            for (i = 0; i < WORLD_Y; i++)
                map[i] = &mapbuf[MAPWIDTH(3) * i];
        } else if (map) {
-           free((s_char *)map);
+           free(map);
            map = (s_char **)0;
        }
     }
index 37c54adf2106177cdc81f14508d5c129daf8f3d5..b73a16b3325fb183fee971f41ffbda3dce9153b5 100644 (file)
@@ -61,7 +61,7 @@ payo(void)
        return RET_SYN;
 
     nships = 0;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
index b95a9de2f79245b907cb64b9f1e654b6a65142d5..38148e93a7b60a744948b853f49ba6d9476c22d6 100644 (file)
@@ -46,7 +46,7 @@ pboa(void)
 
     if (!snxtitem(&np, EF_PLANE, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&np, (s_char *)&plane)) {
+    while (nxtitem(&np, &plane)) {
        getsect(plane.pln_x, plane.pln_y, &sect);
        if (sect.sct_own != player->cnum)
            continue;
index 8d038b469c0b055f8f94c13c838bd89135be68ba..ac9d1f3e81877abcbd62dad9ba8be664b8896675 100644 (file)
@@ -200,7 +200,7 @@ pdump(void)
 
     nplanes = 0;
     natp = getnatp(player->cnum);
-    while (nxtitem(&np, (s_char *)&plane)) {
+    while (nxtitem(&np, &plane)) {
        if (!player->owner || plane.pln_own == 0)
            continue;
        nplanes++;
index 46563e3a817f49acc5bc919b3a3933feb71d874f..66d43048fd9bcbab7a170b6f07b2e2d471b0286f 100644 (file)
@@ -51,7 +51,7 @@ plan(void)
     if (!snxtitem(&np, EF_PLANE, player->argp[1]))
        return RET_SYN;
     nplanes = 0;
-    while (nxtitem(&np, (s_char *)&plane)) {
+    while (nxtitem(&np, &plane)) {
        if (!player->owner || plane.pln_own == 0)
            continue;
        if (nplanes++ == 0) {
index c2f167bc779d9a118a77fc294099c953df4c6b4b..8011ad1ae4d95a2d89695c54bdd98f552dffe41f 100644 (file)
@@ -124,7 +124,7 @@ powe(void)
 
     if (!power_generated) {
        snxtitem_all(&ni, EF_POWER);
-       if (!nxtitem(&ni, (s_char *)&pow)) {
+       if (!nxtitem(&ni, &pow)) {
            pr("Power for this game has not been built yet.  Type 'power new' to build it.\n");
            return RET_FAIL;
        }
@@ -134,7 +134,7 @@ powe(void)
     pr("      as of %s\n         sects  eff civ", ctime(&pow_time));
     pr("  mil  shell gun pet  iron dust oil  pln ship unit money\n");
     snxtitem_all(&ni, EF_POWER);
-    while ((nxtitem(&ni, (s_char *)&pow)) && num > 0) {
+    while ((nxtitem(&ni, &pow)) && num > 0) {
        if (pow.p_nation == 0 || pow.p_power <= 0.0)
            continue;
        if (opt_HIDDEN) {
@@ -251,7 +251,7 @@ gen_power(void)
        addtopow(sect.sct_item, pow);
     }
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        pow = &powbuf[land.lnd_own];
@@ -262,7 +262,7 @@ gen_power(void)
        pow->p_units += 1.0;
     }
     snxtitem_all(&ni, EF_SHIP);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (ship.shp_own == 0)
            continue;
        pow = &powbuf[ship.shp_own];
@@ -273,7 +273,7 @@ gen_power(void)
        pow->p_ships += 1.0;
     }
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        pow = &powbuf[plane.pln_own];
index 081e56f65a7caa51a8b4e1bf3b5bc4008289dc76..08c32593cf508e7ce90f9575264f5d8149a41e75 100644 (file)
@@ -49,7 +49,7 @@ pstat(void)
     if (!snxtitem(&np, EF_PLANE, player->argp[1]))
        return RET_SYN;
     nplanes = 0;
-    while (nxtitem(&np, (s_char *)&plane)) {
+    while (nxtitem(&np, &plane)) {
        if (!player->owner || plane.pln_own == 0)
            continue;
        if (plane.pln_type < 0 || plane.pln_type > pln_maxno) {
index 83e19e6727889f5de4611013938999a568779401..ab354f1fe93226e1f2e4ef6e781f860948a3b27c 100644 (file)
@@ -94,7 +94,7 @@ rada(void)
                pr("Specify at least one ship\n");
                return RET_SYN;
            }
-           while (nxtitem(&ni, (s_char *)&ship)) {
+           while (nxtitem(&ni, &ship)) {
                if (!player->owner)
                    continue;
                if (mchr[(int)ship.shp_type].m_flags & M_SONAR)
@@ -117,7 +117,7 @@ rada(void)
                pr("Specify at least one unit\n");
                return RET_SYN;
            }
-           while (nxtitem(&ni, (s_char *)&land)) {
+           while (nxtitem(&ni, &land)) {
                if (!player->owner)
                    continue;
                if (!(lchr[(int)land.lnd_type].l_flags & L_RADAR)) {
index 546000cc8bbd161c48db868aba613aa264aaf087..47d6336919b2a0a9a292b6c21aeff82bdd96e914 100644 (file)
@@ -50,7 +50,7 @@ range(void)
 
     if (!snxtitem(&np, EF_PLANE, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&np, (s_char *)&plane)) {
+    while (nxtitem(&np, &plane)) {
        if (!player->owner || plane.pln_own == 0)
            continue;
        p = getstarg(player->argp[2], "New range? ", buf);
@@ -82,7 +82,7 @@ lrange(void)
 
     if (!snxtitem(&np, EF_LAND, player->argp[1]))
        return RET_SYN;
-    while (nxtitem(&np, (s_char *)&land)) {
+    while (nxtitem(&np, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        lcp = &lchr[(int)land.lnd_type];
index 2ec7d54b024536daebd431a1a20ebe7aa0ccd749..047d614a7d371c4eabf24c6842f61db112ba0093 100644 (file)
@@ -117,7 +117,7 @@ rea(void)
     lastdate = 0;
     lastcnum = -1;
     lasttype = -1;
-    while (fread((s_char *)&tgm, sizeof(tgm), 1, telfp) == 1) {
+    while (fread(&tgm, sizeof(tgm), 1, telfp) == 1) {
        readit = 1;
        if (tgm.tel_length < 0) {
            logerror("bad telegram file header in %s", mbox);
index 5465fba7372db0ad7d3f72fdf90703dd4e677488..30e983c24d4a4142b5c696cc77d4a34a451b8a18 100644 (file)
@@ -86,7 +86,7 @@ reje(void)
     }
     if (!snxtitem(&ni, EF_NATION, player->argp[3]))
        return RET_SYN;
-    while (nxtitem(&ni, (s_char *)&nat)) {
+    while (nxtitem(&ni, &nat)) {
 #if 0
        if ((nat.nat_stat & STAT_NORM) == 0) {
            pr("You may not reject/accept stuff from %s\nbecause they are not a normal country.\n", nat.nat_cnam);
index a64391e672dc6962d00c08ab668926bef13fbdbe..fced03fec4350e5b2007b0bfec9f96e613106151 100644 (file)
@@ -88,7 +88,7 @@ repo(void)
     } else {
        first = 1;
     }
-    while (nxtitem(&ni, (s_char *)&nat)) {
+    while (nxtitem(&ni, &nat)) {
        if (!(nat.nat_stat & STAT_INUSE))
            continue;
        if (opt_HIDDEN) {
index e92bbc4c40ad6035189f11656336edb3422eefca..6b6d3b9a5d231ae9feedcadd54f4054969f34528 100644 (file)
@@ -132,7 +132,7 @@ retr(void)
     if (zero)
        rflags = 0;
 
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
@@ -261,7 +261,7 @@ lretr(void)
     if (zero)
        rflags = 0;
 
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
index ac19b5774daba3860716b9cdfa008d92f18d6f07..2a123b7fde4d4b8e7e9cbe726015964d0c3f5d79 100644 (file)
@@ -88,20 +88,19 @@ rout(void)
     } else if (!snxtsct(&ns, str))
        return RET_FAIL;
     if (!mapbuf)
-       mapbuf =
-           (s_char *)malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
+       mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
     if (!map) {
-       map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
            for (i = 0; i < WORLD_Y; i++)
                map[i] = &mapbuf[MAPWIDTH(3) * i];
        } else if (map) {
-           free((s_char *)map);
+           free(map);
            map = (s_char **)0;
        }
     }
     if (!buf)
-       buf = (s_char *)malloc((MAPWIDTH(3) + 12) * sizeof(s_char));
+       buf = malloc((MAPWIDTH(3) + 12) * sizeof(s_char));
     if (!mapbuf || !map || !buf) {
        pr("Memory error, tell the deity.\n");
        logerror("malloc failed in rout\n");
index 829633a5d5001fa24b01b1042134777ac078b120..af21f9e005d45e29b9d1d2319adc9bfb02c79b35 100644 (file)
@@ -49,7 +49,7 @@ sabo(void)
     if (!snxtitem(&ni, EF_LAND, player->argp[1]))
        return RET_SYN;
 
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner)
            continue;
        if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
index 809c0992298b5f329f0691accd8ef3de13c631d5..3c50f853386f9ea36adfbfc087e73d1bb9f4539f 100644 (file)
@@ -48,7 +48,7 @@ show_sail(struct nstr_item *nstr)
     int count = 0;
     struct shpstr ship;
 
-    while (nxtitem(nstr, (s_char *)&ship)) {
+    while (nxtitem(nstr, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
@@ -100,7 +100,7 @@ cmd_unsail_ship(struct nstr_item *nstr)
     struct shpstr ship;
     int count = 0;
 
-    while (nxtitem(nstr, (s_char *)&ship)) {
+    while (nxtitem(nstr, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
@@ -124,7 +124,7 @@ cmd_sail_ship(struct nstr_item *nstr)
     struct shpstr ship;
     char navpath[MAX_PATH_LEN];
 
-    while (!player->aborted && nxtitem(nstr, (s_char *)&ship)) {
+    while (!player->aborted && nxtitem(nstr, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
index 92e6d68aae6c9ec652540c0267e60b8bec9b9103..ed675bbf914556d780a474ce1fcb6b273afef99c 100644 (file)
@@ -136,7 +136,7 @@ scra(void)
        if (!confirm(y_or_n))
            return RET_FAIL;
     }
-    while (nxtitem(&ni, (s_char *)&item)) {
+    while (nxtitem(&ni, &item)) {
        if (!player->owner)
            continue;
 
@@ -192,7 +192,7 @@ scra(void)
            sect.sct_item[I_HCM] += mp->m_hcm * 2 / 3 * eff;
            getsect(item.ship.shp_x, item.ship.shp_y, &sect2);
            snxtitem_all(&ni2, EF_PLANE);
-           while (nxtitem(&ni2, (s_char *)&plane)) {
+           while (nxtitem(&ni2, &plane)) {
                if (plane.pln_own == 0)
                    continue;
                if (plane.pln_ship == item.ship.shp_uid) {
@@ -214,11 +214,11 @@ scra(void)
                    plane.pln_own = sect2.sct_own;
                    makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
                                plane.pln_x, plane.pln_y);
-                   putplane(plane.pln_uid, (s_char *)&plane);
+                   putplane(plane.pln_uid, &plane);
                }
            }
            snxtitem_all(&ni2, EF_LAND);
-           while (nxtitem(&ni2, (s_char *)&land)) {
+           while (nxtitem(&ni2, &land)) {
                if (land.lnd_own == 0)
                    continue;
                if (land.lnd_ship == item.ship.shp_uid) {
@@ -240,13 +240,13 @@ scra(void)
                    land.lnd_own = sect2.sct_own;
                    makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
                                land.lnd_x, land.lnd_y);
-                   putland(land.lnd_uid, (s_char *)&land);
+                   putland(land.lnd_uid, &land);
                }
            }
            makelost(EF_SHIP, item.ship.shp_own, item.ship.shp_uid,
                     item.ship.shp_x, item.ship.shp_y);
            item.ship.shp_own = 0;
-           putship(item.ship.shp_uid, (s_char *)&item.ship);
+           putship(item.ship.shp_uid, &item.ship);
        } else if (type == EF_LAND) {
            eff = ((float)item.land.lnd_effic / 100.0);
            lp = &lchr[(int)item.land.lnd_type];
@@ -259,7 +259,7 @@ scra(void)
            getsect(item.land.lnd_x, item.land.lnd_y, &sect2);
 
            snxtitem_all(&ni2, EF_LAND);
-           while (nxtitem(&ni2, (s_char *)&land)) {
+           while (nxtitem(&ni2, &land)) {
                if (land.lnd_own == 0)
                    continue;
                if (land.lnd_land == item.land.lnd_uid) {
@@ -281,12 +281,12 @@ scra(void)
                    land.lnd_own = sect2.sct_own;
                    makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
                                land.lnd_x, land.lnd_y);
-                   putland(land.lnd_uid, (s_char *)&land);
+                   putland(land.lnd_uid, &land);
                }
            }
 
            snxtitem_all(&ni2, EF_PLANE);
-           while (nxtitem(&ni2, (s_char *)&plane)) {
+           while (nxtitem(&ni2, &plane)) {
                if (plane.pln_own == 0)
                    continue;
                if (plane.pln_land == item.land.lnd_uid) {
@@ -308,13 +308,13 @@ scra(void)
                    plane.pln_own = sect2.sct_own;
                    makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
                                plane.pln_x, plane.pln_y);
-                   putplane(plane.pln_uid, (s_char *)&plane);
+                   putplane(plane.pln_uid, &plane);
                }
            }
            makelost(EF_LAND, item.land.lnd_own, item.land.lnd_uid,
                     item.land.lnd_x, item.land.lnd_y);
            item.land.lnd_own = 0;
-           putland(item.land.lnd_uid, (s_char *)&item.land);
+           putland(item.land.lnd_uid, &item.land);
        } else {
            eff = ((float)item.land.lnd_effic / 100.0);
            pp = &plchr[(int)item.plane.pln_type];
@@ -325,7 +325,7 @@ scra(void)
            makelost(EF_PLANE, item.plane.pln_own, item.plane.pln_uid,
                     item.plane.pln_x, item.plane.pln_y);
            item.plane.pln_own = 0;
-           putplane(item.plane.pln_uid, (s_char *)&item.plane);
+           putplane(item.plane.pln_uid, &item.plane);
        }
        pr(" scrapped in %s\n",
           xyas(sect.sct_x, sect.sct_y, player->cnum));
index b8a016057be0953196e1d411bb6c5190331a60b4..d4069be0a9dd7ecd137dd0ec181b2e6b14ea59b0 100644 (file)
@@ -203,7 +203,7 @@ scut(void)
        if (!confirm(y_or_n))
            return RET_FAIL;
     }
-    while (nxtitem(&ni, (s_char *)&item)) {
+    while (nxtitem(&ni, &item)) {
        if (!player->owner)
            continue;
        if (opt_MARKET) {
@@ -241,7 +241,7 @@ scut(void)
            makelost(EF_PLANE, item.plane.pln_own, item.plane.pln_uid,
                     item.plane.pln_x, item.plane.pln_y);
            item.plane.pln_own = 0;
-           putplane(item.plane.pln_uid, (s_char *)&item.plane);
+           putplane(item.plane.pln_uid, &item.plane);
        }
        pr(" scuttled in %s\n",
           xyas(item.ship.shp_x, item.ship.shp_y, player->cnum));
@@ -260,7 +260,7 @@ scuttle_ship(struct shpstr *sp)
 
     getsect(sp->shp_x, sp->shp_y, &sect);
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        if (plane.pln_ship == sp->shp_uid) {
@@ -278,11 +278,11 @@ scuttle_ship(struct shpstr *sp)
                   plane.pln_uid, sp->shp_uid,
                   xyas(plane.pln_x, plane.pln_y, plane.pln_own));
            }
-           putplane(plane.pln_uid, (s_char *)&plane);
+           putplane(plane.pln_uid, &plane);
        }
     }
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (land.lnd_ship == sp->shp_uid) {
@@ -292,7 +292,7 @@ scuttle_ship(struct shpstr *sp)
                   "Land unit %d transferred off ship %d to %s\n",
                   land.lnd_uid, sp->shp_uid,
                   xyas(land.lnd_x, land.lnd_y, land.lnd_own));
-               putland(land.lnd_uid, (s_char *)&land);
+               putland(land.lnd_uid, &land);
            } else
                scuttle_land(&land);
        }
@@ -312,7 +312,7 @@ scuttle_land(struct lndstr *lp)
 
     getsect(lp->lnd_x, lp->lnd_y, &sect);
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        if (plane.pln_land == lp->lnd_uid) {
@@ -330,11 +330,11 @@ scuttle_land(struct lndstr *lp)
                   plane.pln_uid, lp->lnd_uid,
                   xyas(plane.pln_x, plane.pln_y, plane.pln_own));
            }
-           putplane(plane.pln_uid, (s_char *)&plane);
+           putplane(plane.pln_uid, &plane);
        }
     }
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (land.lnd_land == lp->lnd_uid) {
@@ -344,7 +344,7 @@ scuttle_land(struct lndstr *lp)
                   "Land unit %d transferred off unit %d to %s\n",
                   land.lnd_uid, lp->lnd_uid,
                   xyas(land.lnd_x, land.lnd_y, land.lnd_own));
-               putland(land.lnd_uid, (s_char *)&land);
+               putland(land.lnd_uid, &land);
            } else
                scuttle_land(&land);
        }
index ca78637f12eab9be771ae3c819b156b92e75cb47..56ac3647eb5d3f09407068db347978a24452fd55 100644 (file)
@@ -264,7 +264,7 @@ sdump(void)
 
     nships = 0;
     np = getnatp(player->cnum);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
index a128fbde5ada6c052febc52de26a97906674d4cc..f0eef51443a047f2f6f39683b91f3dabde17cd80 100644 (file)
@@ -80,15 +80,14 @@ sct(void)
     } else if (!snxtsct(&ns, str))
        return RET_SYN;
     if (!mapbuf)
-       mapbuf =
-           (s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       mapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
     if (!map) {
-       map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
            for (i = 0; i < WORLD_Y; i++)
                map[i] = &mapbuf[MAPWIDTH(1) * i];
        } else if (map) {
-           free((s_char *)map);
+           free(map);
            map = (s_char **)0;
        }
     }
index f49b75b6f32e552d6814740d588343fed6d91501..39b03de69e2bf01128098381f10f32f8199b652f 100644 (file)
@@ -90,7 +90,7 @@ set(void)
        type = EF_LAND;
     if (!snxtitem(&ni, type, player->argp[2]))
        return RET_SYN;
-    while (nxtitem(&ni, (char *)&item)) {
+    while (nxtitem(&ni, &item)) {
        if (!player->owner && !player->god)
            continue;
        getsect(item.gen.trg_x, item.gen.trg_y, &sect);
@@ -113,7 +113,7 @@ set(void)
        foundslot = -1;
        freeslot = -1;
        snxtitem_all(&ni_trade, EF_TRADE);
-       while (nxtitem(&ni_trade, (char *)&trade)) {
+       while (nxtitem(&ni_trade, &trade)) {
            if (trade.trd_owner == 0)
                freeslot = ni_trade.cur;
            if (trade.trd_unitid == ni.cur && trade.trd_type == type) {
index 7a447cc81ba29fb83c0759c64be78b182d4bff5c..1188cbab29223e0b105514256893b7d21de257ba 100644 (file)
@@ -52,7 +52,7 @@ shi(void)
        return RET_SYN;
 
     nships = 0;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
index 1cee79eabdab1893ee81e67c108a492ee4ce2bdc..03411d8c21770c5f0a51f82b573d1db970c5c154 100644 (file)
@@ -80,7 +80,7 @@ shoo(void)
        mil = sect.sct_item[I_MILIT];
        nsec = 0;
        snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
-       while (nxtitem(&ni, (s_char *)&land)) {
+       while (nxtitem(&ni, &land)) {
            mil += total_mil(&land);
 
            if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
index 3103d50e3b6de9e9d56ea08a1c095dd8d8541a48..af58cb37cfa312b358ab360d09ff4e31175f7133 100644 (file)
@@ -74,9 +74,9 @@ skyw(void)
        return RET_SYN;
     for (i = 0; i < TSIZE; i++)
        list[i] = 0;
-    skyp = (struct sky *)malloc(sizeof(*skyp));
+    skyp = malloc(sizeof(*skyp));
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&skyp->s_sat)) {
+    while (nxtitem(&ni, &skyp->s_sat)) {
        if (!skyp->s_sat.pln_own)
            continue;
        if (!(skyp->s_sat.pln_flags & PLN_LAUNCHED))
@@ -86,11 +86,11 @@ skyw(void)
        skyp->s_spotted = 0;
        skyp->s_next = list[n];
        list[n] = skyp;
-       skyp = (struct sky *)malloc(sizeof(*skyp));
+       skyp = malloc(sizeof(*skyp));
        nsat++;
     }
     /* get that last one! */
-    free((s_char *)skyp);
+    free(skyp);
     pr("- = [ Skywatch report for %s ] = -\n", cname(player->cnum));
     pr(" %18s%20s        %s\n", "Country", "Satellite", "Location");
     tech = tfact(player->cnum, 1.0);
@@ -126,7 +126,7 @@ skyw(void)
     for (i = 0; i < TSIZE; i++) {
        while (NULL != (skyp = list[i])) {
            list[i] = skyp->s_next;
-           free((s_char *)skyp);
+           free(skyp);
        }
     }
     return RET_OK;
@@ -148,7 +148,7 @@ showsat(struct sky **skypp, int x, int y)
     do {
        /* we delete it, we free it. */
        if (todelete) {
-           free((s_char *)todelete);
+           free(todelete);
            todelete = 0;
        }
        if (skyp->s_sat.pln_x != x || skyp->s_sat.pln_y != y) {
@@ -170,6 +170,6 @@ showsat(struct sky **skypp, int x, int y)
     } while (NULL != (skyp = skyp->s_next));
     /* check that last one! */
     if (todelete)
-       free((s_char *)todelete);
+       free(todelete);
     return (nsat);
 }
index 11d09b73a97ca3ff2ef8433a4dbed92517978cff..ff006850e7d7e8c8d77983bb6db2b7aa9e94b002 100644 (file)
@@ -80,30 +80,28 @@ sona(void)
     if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
        return RET_SYN;
     if (!radbuf)
-       radbuf =
-           (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
+       radbuf = malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
     if (!visbuf)
-       visbuf =
-           (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
+       visbuf = malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
     if (!rad) {
-       rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       rad = malloc(WORLD_Y * sizeof(s_char *));
        if (rad && radbuf) {
            for (x = 0; x < WORLD_Y; x++) {
                rad[x] = &radbuf[(WORLD_X + 1) * x];
            }
        } else if (rad) {
-           free((s_char *)rad);
+           free(rad);
            rad = (s_char **)0;
        }
     }
     if (!vis) {
-       vis = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       vis = malloc(WORLD_Y * sizeof(s_char *));
        if (vis && visbuf) {
            for (x = 0; x < WORLD_Y; x++) {
                vis[x] = &visbuf[(WORLD_X + 1) * x];
            }
        } else if (vis) {
-           free((s_char *)vis);
+           free(vis);
            vis = (s_char **)0;
        }
     }
@@ -112,7 +110,7 @@ sona(void)
        logerror("malloc failed in sona\n");
        return RET_FAIL;
     }
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner)
            continue;
        mcp = &mchr[(int)ship.shp_type];
index d6eecbfbf2e1e3b8eb58bffb2086d910a390b47a..3259c2cad0bdfed52b5acd4c656796245a6044a3 100644 (file)
@@ -99,7 +99,7 @@ spy(void)
      * set up all the goodies we need later
      * 6 = neighbors, 2 = x,y
      */
-    table = (coord *)malloc((nsects + 1) * 6 * 2 * sizeof(coord));
+    table = malloc((nsects + 1) * 6 * 2 * sizeof(coord));
     memset(table, 0, (nsects + 1) * 6 * 2 * sizeof(coord));
     pr("SPY report\n");
     prdate();
@@ -111,7 +111,7 @@ spy(void)
        nrecon = 0;
        nunits = 0;
        snxtitem_xy(&ni, EF_LAND, from.sct_x, from.sct_y);
-       while (nxtitem(&ni, (s_char *)&land)) {
+       while (nxtitem(&ni, &land)) {
            nunits++;
            if (lchr[(int)land.lnd_type].l_flags & L_RECON)
                nrecon++;
@@ -208,7 +208,7 @@ spy(void)
     if (changed)
        writemap(player->cnum);
     player->btused += btucost;
-    free((s_char *)table);
+    free(table);
     return RET_OK;
 }
 
@@ -275,7 +275,7 @@ num_units(int x, int y)
     int n = 0;
 
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if ((land.lnd_own == player->cnum) || (land.lnd_own == 0))
            continue;
        if (land.lnd_ship >= 0 || land.lnd_land >= 0)
@@ -294,7 +294,7 @@ prunits(int x, int y)
     s_char report[128];
 
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == player->cnum || land.lnd_own == 0)
            continue;
        if (land.lnd_ship >= 0 || land.lnd_land >= 0)
@@ -330,7 +330,7 @@ prplanes(int x, int y)
     s_char report[128];
 
     snxtitem_xy(&ni, EF_PLANE, x, y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == player->cnum || plane.pln_own == 0)
            continue;
        if (plane.pln_ship >= 0 || plane.pln_land >= 0)
index 730a33350e70c3ef576c486a1b3698f291ac93a7..48343ab69f31c87c288daaa1b2e322990e51c629 100644 (file)
@@ -49,7 +49,7 @@ sstat(void)
        return RET_SYN;
 
     nships = 0;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
        if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
index 919d1f0c7d4be2c936c5a99e70407d9366882a51..39f436a7b470455fa53809afd5784a2b3439dae5 100644 (file)
@@ -126,7 +126,7 @@ units_in_sector(struct combat *def)
     struct lndstr land;
 
     snxtitem_xy(&ni, EF_LAND, def->x, def->y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (land.lnd_own != def->own)
index e7522330e96dcdce0717fad0c5ccc044ac56fcb3..ad381d9c594510706482f8505d62490e1706145e 100644 (file)
@@ -166,7 +166,7 @@ starv_ships(s_char *range)
     if (!snxtitem(&ni, EF_SHIP, range))
        return;
 
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || !ship.shp_own)
            continue;
 
@@ -214,7 +214,7 @@ starv_units(s_char *range)
     if (!snxtitem(&ni, EF_LAND, range))
        return;
 
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner || !land.lnd_own)
            continue;
 
index 9af50a83d7838b7a4b8a07329fe784c981a711c9..a22daf2f8bbafc6a39419af64b1b2b82268725c2 100644 (file)
@@ -49,7 +49,7 @@ supp(void)
        return RET_SYN;
 
     nunits = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        nunits++;
index ab7450821ca346654a78cf694294136f0f858a0e..8a401e2d535e192d48111793c18c3da9c76dd9d9 100644 (file)
@@ -106,7 +106,7 @@ surv(void)
            for (i = 0; i < WORLD_Y; i++)
                map[i] = &mapbuf[MAPWIDTH(1) * i];
        } else if (map) {
-           free((s_char *)map);
+           free(map);
            map = (s_char **)0;
        }
     }
index 5223a30a6a049af4a759e16f161c6bc8d546e309..29648c97de5435abba3e6f01c09677b98bff36bd 100644 (file)
@@ -90,7 +90,7 @@ tend(void)
                  getstarg(player->argp[2], "Tender(s)? ", buf)))
        return RET_SYN;
 
-    while (nxtitem(&tenders, (s_char *)&tender)) {
+    while (nxtitem(&tenders, &tender)) {
        if (!player->owner)
            continue;
        if (type == EF_LAND) {
@@ -211,7 +211,7 @@ tend_land(struct shpstr *tenderp, s_char *units)
     if (!snxtitem(&lni, EF_LAND, units))
        return RET_SYN;
 
-    while (nxtitem(&lni, (s_char *)&land)) {
+    while (nxtitem(&lni, &land)) {
        if (!player->owner)
            continue;
        if (land.lnd_ship != tenderp->shp_uid) {
@@ -272,7 +272,7 @@ tend_land(struct shpstr *tenderp, s_char *units)
            count_units(tenderp);
            putship(tenderp->shp_uid, tenderp);
            snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
-           while (nxtitem(&pni, (s_char *)&plane)) {
+           while (nxtitem(&pni, &plane)) {
                if (plane.pln_flags & PLN_LAUNCHED)
                    continue;
                if (plane.pln_land != land.lnd_uid)
index dd6345ccac84b9aad92a13a5044579fe1e56cdc3..0bae564e40d10704b07a07402d5148f88857af3d 100644 (file)
@@ -81,7 +81,7 @@ torp(void)
        return RET_SYN;
     if (!snxtitem(&nbst, EF_SHIP, sav))
        return RET_SYN;
-    while (nxtitem(&nbst, (s_char *)&sub)) {
+    while (nxtitem(&nbst, &sub)) {
        if (sub.shp_own != player->cnum)
            continue;
        if ((mchr[(int)sub.shp_type].m_flags & M_TORP) == 0)
@@ -102,7 +102,7 @@ torp(void)
     }
     pr("%d ships are eligible to torp\n", ntorping);
     snxtitem(&nbst, EF_SHIP, sav);
-    while (nxtitem(&nbst, (s_char *)&sub)) {
+    while (nxtitem(&nbst, &sub)) {
        if (!sub.shp_own)
            continue;
        if (sub.shp_own != player->cnum) {
index b1e2facf542b7b5462f12277cbfd077888723dcf..403b15395614275b15e29fb93c696a4d422336d5 100644 (file)
@@ -95,7 +95,7 @@ trad(void)
     pr(" --- --------  -- --------- -----  -------------------------\n");
 
     snxtitem_all(&ni, EF_TRADE);
-    while (nxtitem(&ni, (char *)&trade)) {
+    while (nxtitem(&ni, &trade)) {
        if (trade.trd_owner == 0)
            continue;
        if (!trade_getitem(&trade, &tg)) {
@@ -512,7 +512,7 @@ check_trade(void)
            tg.lnd.lnd_mission = 0;
            /* Drop any land units this unit was carrying */
            snxtitem_xy(&ni, EF_LAND, tg.lnd.lnd_x, tg.lnd.lnd_y);
-           while (nxtitem(&ni, (s_char *)&land)) {
+           while (nxtitem(&ni, &land)) {
                if (land.lnd_land != tg.lnd.lnd_uid)
                    continue;
                land.lnd_land = -1;
@@ -523,7 +523,7 @@ check_trade(void)
            }
            /* Drop any planes this unit was carrying */
            snxtitem_xy(&ni, EF_PLANE, tg.lnd.lnd_x, tg.lnd.lnd_y);
-           while (nxtitem(&ni, (s_char *)&plane)) {
+           while (nxtitem(&ni, &plane)) {
                if (plane.pln_flags & PLN_LAUNCHED)
                    continue;
                if (plane.pln_land != land.lnd_uid)
@@ -541,7 +541,7 @@ check_trade(void)
            logerror("Bad trade type %d in trade\n", trade.trd_type);
            break;
        }
-       if (!ef_write(trade.trd_type, saveid, (char *)&tg)) {
+       if (!ef_write(trade.trd_type, saveid, &tg)) {
            logerror("Couldn't write unit to disk; seek help.\n");
            continue;
        }
index b24493e6989c5a570a769dece80c165510305a38..84652ac0116c52e332aaeadc85b5733bb1f6b499 100644 (file)
@@ -208,7 +208,7 @@ tran_plane(void)
      * No one could seriously want to move planes in parallel from
      * several sectors!
      */
-    while (nxtitem(&nstr, (s_char *)&plane)) {
+    while (nxtitem(&nstr, &plane)) {
        if (!player->owner)
            continue;
        type = plane.pln_type;
@@ -260,7 +260,7 @@ tran_plane(void)
     dstx = endsect.sct_x;
     dsty = endsect.sct_y;
     snxtitem_rewind(&nstr);
-    while (nxtitem(&nstr, (s_char *)&plane)) {
+    while (nxtitem(&nstr, &plane)) {
        if (!player->owner)
            continue;
        if (dam)
index d05e42dcc393a3e6752cb9f27c8a5ec579a4efa6..9984aecf6836ffd2847b8a29e384177fb4da18bb 100644 (file)
@@ -51,7 +51,7 @@ trea(void)
        return RET_SYN;
     pr("\t... %s Treaty Report ...\n", cname(player->cnum));
     ntreaty = 0;
-    while (nxtitem(&nstr, (s_char *)&treaty)) {
+    while (nxtitem(&nstr, &treaty)) {
        if (distrea(nstr.cur, &treaty) > 0)
            ntreaty++;
     }
index c1ddd72ae46bc3fc359d7c6fb14f0312a952a198..51acde5d0b9d72762e16e5096a7d51b783dd933c 100644 (file)
@@ -98,7 +98,7 @@ lupgr(void)
     cash = natp->nat_money;
     tlev = (int)natp->nat_level[NAT_TLEV];
     n = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        getsect(land.lnd_x, land.lnd_y, &sect);
@@ -181,7 +181,7 @@ supgr(void)
     cash = natp->nat_money;
     tlev = (int)natp->nat_level[NAT_TLEV];
     n = 0;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (ship.shp_own == 0)
            continue;
        getsect(ship.shp_x, ship.shp_y, &sect);
@@ -263,7 +263,7 @@ pupgr(void)
     cash = natp->nat_money;
     tlev = (int)natp->nat_level[NAT_TLEV];
     n = 0;
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        getsect(plane.pln_x, plane.pln_y, &sect);
index 1e33a769c4867d3d1de2ce54e1d9dea375fc72c8..0fa4d57b5a9296fcda812b56810cf2b9f391526d 100644 (file)
@@ -67,7 +67,7 @@ work(void)
        return RET_FAIL;
     }
     nunits = 0;
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!player->owner || land.lnd_own == 0)
            continue;
        if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
index 327e6ef0ddb363255c39875e807f3dd386d1332f..aa84088401522c86a0e4bc65ec0073b772102768 100644 (file)
@@ -132,13 +132,12 @@ bestownedpath(s_char *bpath,
     unsigned int routelen;
 
     if (!mapbuf)
-       mapbuf = (unsigned int *)malloc((WORLD_X * WORLD_Y) *
+       mapbuf = malloc((WORLD_X * WORLD_Y) *
                                        sizeof(unsigned int));
     if (!mapbuf)
        return ((s_char *)0);
     if (!mapindex) {
-       mapindex =
-           (unsigned int **)malloc(WORLD_X * sizeof(unsigned int *));
+       mapindex = malloc(WORLD_X * sizeof(unsigned int *));
        if (mapindex) {
            /* Setup the map pointers */
            for (i = 0; i < WORLD_X; i++)
@@ -160,7 +159,7 @@ bestownedpath(s_char *bpath,
     if (x == ex && y == ey) {
        bpath[0] = 'h';
        bpath[1] = 0;
-       return ((s_char *)bpath);
+       return bpath;
     }
 
     if (!valid(x, y) || !valid(ex, ey))
@@ -186,7 +185,7 @@ bestownedpath(s_char *bpath,
        if (++routelen == MAXROUTE) {
            bpath[0] = '?';
            bpath[1] = 0;
-           return ((s_char *)bpath);
+           return bpath;
        }
        markedsectors = 0;
        for (scanx = minx; scanx <= maxx; scanx++) {
@@ -219,7 +218,7 @@ bestownedpath(s_char *bpath,
                                    tx = XNORM(tx);
                                    ty = YNORM(ty);
                                }
-                               return ((s_char *)bpath);
+                               return bpath;
                            }
                        }
                    }
index 6a62767610af80c3bc67a0e550a8083984ea5128..a90255750bf72fe458d178689e5cd2e1ef255ab9 100644 (file)
@@ -117,7 +117,7 @@ knockdown(struct sctstr *sp, struct emp_qelem *list)
 
     /* Sink all the units */
     snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y)
@@ -137,7 +137,7 @@ knockdown(struct sctstr *sp, struct emp_qelem *list)
     }
     /* Sink all the planes */
     snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        if (plane.pln_x != sp->sct_x || plane.pln_y != sp->sct_y)
index b9ccdc6d80f4b39e39ff612dca8771457fec0ef9..0f5156abb5ed2f05d32da3bd9658d9ace0e30967 100644 (file)
@@ -62,7 +62,7 @@ has_units(coord x, coord y, natid cn, struct lndstr *lp)
     int n;
     struct lndstr land;
 
-    for (n = 0; ef_read(EF_LAND, n, (s_char *)&land); n++) {
+    for (n = 0; ef_read(EF_LAND, n, &land); n++) {
        if (land.lnd_x != x || land.lnd_y != y)
            continue;
        if (lp) {
@@ -85,7 +85,7 @@ has_units_with_mob(coord x, coord y, natid cn)
     struct lndstr land;
 
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own != cn)
            continue;
        if (land.lnd_mobil > 0)
@@ -105,7 +105,7 @@ has_helpful_engineer(coord x, coord y, natid cn)
     struct lndstr land;
 
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own != cn && getrel(getnatp(land.lnd_own), cn) != ALLIED)
            continue;
        if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
index 3ae28c2778909d043dd4b59134da3f5e796d9f16..dd1b2a4b5fa7fb0d66d9d271e3359f4846f3084d 100644 (file)
@@ -70,20 +70,19 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
     static s_char **wmap = (s_char **)0;
 
     if (!wmapbuf)
-       wmapbuf =
-           (s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
+       wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
     if (!wmap) {
-       wmap = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       wmap = malloc(WORLD_Y * sizeof(s_char *));
        if (wmap && wmapbuf) {
            for (i = 0; i < WORLD_Y; i++)
                wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
        } else if (wmap) {
-           free((s_char *)wmap);
+           free(wmap);
            wmap = (s_char **)0;
        }
     }
     if (!bitmap)
-       bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8);
+       bitmap = malloc((WORLD_X * WORLD_Y) / 8);
     if (!wmapbuf || !wmap || !bitmap) {
        pr("Memory error, tell the deity.\n");
        logerror("malloc failed in draw_map\n");
index 99b667a52efb74cbe4921dbd31f1806338d13740..3122e426eda8cb560805b899827564052a83ba8f 100644 (file)
@@ -81,7 +81,7 @@ bp_init(void)
 
     ep = &empfile[EF_SECTOR];
 
-    bp = (struct bestp *)malloc(sizeof(*bp));
+    bp = malloc(sizeof(*bp));
     memset(bp, 0, sizeof(*bp));
     bp->adp = as_init(BP_NEIGHBORS, BP_ASHASHSIZE, bp_coord_hash,
                      bp_neighbors, bp_lbcost, bp_realcost,
@@ -91,9 +91,8 @@ bp_init(void)
        return NULL;
 
     if (neighsects == (struct sctstr **)0)
-       neighsects = (struct sctstr **)calloc(1, (sizeof(struct sctstr *) *
-                                                 ((WORLD_X * WORLD_Y) /
-                                                  2) * 6));
+       neighsects = calloc(((WORLD_X * WORLD_Y) / 2) * 6,
+                           sizeof(struct sctstr *));
 
     return (s_char *)bp;
 }
index a16e21a3421fb50396960d15989609d5c21b2569..47208eabb418bd5b7690df561df436289209a5ff 100644 (file)
@@ -108,7 +108,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
        return eff;
 
     snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!land.lnd_own)
            continue;
        landdamage(&land, dam);
@@ -119,7 +119,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
     if (dam <= 0)
        return eff;
     snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (!plane.pln_own)
            continue;
        if (plane.pln_flags & PLN_LAUNCHED)
index 8412bbfd3ad9bbbc24ea9ef3d73d91d70dc52ae1..5d87ed73ed76e604283fa950c359e5f2e7d68ca4 100644 (file)
@@ -414,7 +414,7 @@ empth_init(char **ctx_ptr, int flags)
     SetConsoleCtrlHandler((PHANDLER_ROUTINE)loc_Exit_Handler, TRUE);
 
     /* Create the global Thread context. */
-    pThread = (loc_Thread_t *)malloc(sizeof(*pThread));
+    pThread = malloc(sizeof(*pThread));
     if (!pThread) {
        logerror("not enough memory to create main thread.");
        return 0;
@@ -461,7 +461,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
 
     loc_debug("creating new thread %s:%s", name, desc);
 
-    pThread = (loc_Thread_t *)malloc(sizeof(*pThread));
+    pThread = malloc(sizeof(*pThread));
     if (!pThread) {
        logerror("not enough memory to create thread: %s (%s)", name,
                 desc);
@@ -671,7 +671,7 @@ empth_sem_create(char *name, int cnt)
 {
     loc_Sem_t *pSem;
 
-    pSem = (loc_Sem_t *)malloc(sizeof(*pSem));
+    pSem = malloc(sizeof(*pSem));
     if (!pSem) {
        logerror("out of memory at %s:%d", __FILE__, __LINE__);
        return NULL;
index 41cee7b7d26efe33c44e4aff37ab114c8b99e4a2..6379d5b08e5f345aabcca613f3184cf1c00d98f6 100644 (file)
@@ -140,7 +140,7 @@ empth_init(char **ctx_ptr, int flags)
     sigaction(SIGALRM, &act, NULL);
 
     udata = ctx_ptr;
-    ctx = (empth_t *)malloc(sizeof(empth_t));
+    ctx = malloc(sizeof(empth_t));
     if (!ctx) {
        logerror("pthread init failed: not enough memory");
        exit(1);
@@ -176,7 +176,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
 
     empth_status("creating new thread %s:%s", name, desc);
 
-    ctx = (empth_t *)malloc(sizeof(empth_t));
+    ctx = malloc(sizeof(empth_t));
     if (!ctx) {
        logerror("not enough memoty to create thread: %s (%s)", name,
                 desc);
@@ -262,7 +262,7 @@ empth_restorectx(void)
 #else
     ctx_ptr = (empth_t *)pthread_getspecific(ctx_key);
 #endif
-    *udata = (char *)ctx_ptr->ud;
+    *udata = ctx_ptr->ud;
     if (ctx_ptr->state == EMPTH_KILLED) {
        empth_status("i am dead");
        empth_exit();
@@ -447,7 +447,7 @@ empth_sem_create(char *name, int cnt)
 {
     empth_sem_t *sm;
 
-    sm = (empth_sem_t *)malloc(sizeof(empth_sem_t));
+    sm = malloc(sizeof(empth_sem_t));
     if (!sm) {
        logerror("out of memory at %s:%d", __FILE__, __LINE__);
        return NULL;
index 983eccb1fd243b71fde939697817d48f201849a1..f7efadc710adc99df58880ddcf8244037b6da1f4 100644 (file)
@@ -89,7 +89,7 @@ io_open(int fd, int flags, int bufsize, int (*notify)(void),
     flags = flags & (IO_READ | IO_WRITE | IO_NBLOCK | IO_NEWSOCK);
     if ((flags & (IO_READ | IO_WRITE)) == 0)
        return NULL;
-    iop = (struct iop *)malloc(sizeof(struct iop));
+    iop = malloc(sizeof(struct iop));
     if (!iop)
        return NULL;
     iop->fd = fd;
@@ -122,7 +122,7 @@ io_close(struct iop *iop)
 #else
     closesocket(iop->fd);
 #endif
-    free((s_char *)iop);
+    free(iop);
 }
 
 int
index 472a855635537d483ffbfb57cbe7fa888d146fff..16ab4fd3e3d96ffd12ce203880a42c827ef5ec48 100644 (file)
@@ -66,7 +66,7 @@ ioq_create(int size)
 {
     struct ioqueue *ioq;
 
-    ioq = (struct ioqueue *)malloc(sizeof(struct ioqueue));
+    ioq = malloc(sizeof(struct ioqueue));
     emp_initque(&ioq->list.queue);
     ioq->list.nbytes = 0;
     ioq->list.offset = 0;
@@ -84,7 +84,7 @@ ioq_destroy(struct ioqueue *ioq)
 /* ioq_drain doesn't work under aix or NeXT... dunno why --ts */
     ioq_drain(ioq);
 #endif /* aix */
-    free((s_char *)ioq);
+    free(ioq);
 }
 
 void
@@ -318,7 +318,7 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
        len = cc > ioq->bufsize ? cc : ioq->bufsize;
        ptr = malloc(len);
        memcpy(ptr, buf, cc);
-       io = (struct io *)malloc(sizeof(struct io));
+       io = malloc(sizeof(struct io));
        io->nbytes = cc;
        io->size = len;
        io->offset = 0;
index a9ee4d50f742abacd26ca5aaa5a5a0c139cee7ab..05c8e755c65ba3a7c2217111d852629ae678c11a 100644 (file)
@@ -41,7 +41,7 @@ strdup(char *x)
 {
     char *y;
 
-    y = (char *)malloc((sizeof(char) * strlen(x)) + 1);
+    y = malloc((sizeof(char) * strlen(x)) + 1);
     strcpy(y, x);
     return y;
 }
index da05e4f9a6895f65e97ea88dd3716889d87327c4..75282412f2ac3ba21aa0441c9e41df8cbbf0cad6 100644 (file)
@@ -71,7 +71,7 @@ lwpInitContext(struct lwpProc *newp, void *sp)
     int endpoint;
 
     if (initcontext == NULL) {
-       initcontext = (struct lwpProc *)malloc(sizeof(struct lwpProc));
+       initcontext = malloc(sizeof(struct lwpProc));
        tempcontext = &holder;
        if (!setjmp(tempcontext->context))
            startcontext();
index 464dbdd30c8d4a52bac0dbf31255818df40ad522..6d7e0e901d38ce23d34daf73dd4c80358f98c262 100644 (file)
@@ -215,7 +215,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name,
 #endif /* UCONTEXT */
     unsigned long stackp;
 
-    if (!(newp = (struct lwpProc *)malloc(sizeof(struct lwpProc))))
+    if (!(newp = malloc(sizeof(struct lwpProc))))
        return (0);
     if (flags & LWP_STACKCHECK) {
        /* Add a 1K buffer on each side of the stack */
@@ -223,7 +223,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name,
     }
     size += LWP_EXTRASTACK;
     size += sizeof(stkalign_t);
-    if (!(s = (int *)malloc(size)))
+    if (!(s = malloc(size)))
        return (0);
     newp->flags = flags;
     newp->name = strdup(name);
@@ -304,7 +304,7 @@ lwpDestroy(struct lwpProc *proc)
     proc->entry = 0;
     proc->ud = 0;
     proc->argv = 0;
-    free((char *)proc->sbtm);
+    free(proc->sbtm);
     free(proc->name);
     free(proc->desc);
     proc->name = 0;
@@ -312,7 +312,7 @@ lwpDestroy(struct lwpProc *proc)
     proc->sbtm = 0;
     proc->lowmark = 0;
     proc->himark = 0;
-    free((char *)proc);
+    free(proc);
 }
 
 /*
@@ -434,7 +434,7 @@ lwpInitSystem(int pri, char **ctxptr, int flags)
     /* *LwpContextPtr = 0; */
     if (!(LwpCurrent = calloc(1, sizeof(struct lwpProc))))
        return (0);
-    if (!(stack = (int *)malloc(64)))
+    if (!(stack = malloc(64)))
        return (0);
     if (LWP_MAX_PRIO <= pri)
        pri = LWP_MAX_PRIO - 1;
index 9e2aaaca85acd2544c8e1df73fa3f02211939c2e..419153d5d14d6152215b99223a07611445a80c9a 100644 (file)
@@ -73,8 +73,7 @@ lwpInitSelect(struct lwpProc *proc)
 #endif
     FD_ZERO(&LwpSelect.readmask);
     FD_ZERO(&LwpSelect.writemask);
-    LwpSelect.wait = (struct lwpProc **)
-       calloc(LwpSelect.nfile, sizeof(char *));
+    LwpSelect.wait = calloc(LwpSelect.nfile, sizeof(char *));
     LwpSelect.delayq.head = 0;
     LwpSelect.delayq.tail = 0;
     LwpSelect.proc = proc;
index b6bd8df4ca92838feae256f5bae8ecc00d87f540..0557222146d7d7b5460e46ea3264e2a1dab1e7fa 100644 (file)
@@ -42,7 +42,7 @@ lwpCreateSem(char *name, int count)
 {
     struct lwpSem *new;
 
-    if (!(new = (struct lwpSem *)malloc(sizeof(struct lwpSem))))
+    if (!(new = malloc(sizeof(struct lwpSem))))
        return (0);
     new->name = strdup(name);
     new->count = count;
index 0bba562750a00c2ef6e35e2152fbd783d1f3bbe6..55b354be67bd7241d14e3587c599481c11a503e1 100644 (file)
@@ -93,8 +93,7 @@ player_init(void)
     }
     val = 1;
 #if !(defined(__linux__) && defined(__alpha__))
-    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val))
-       < 0) {
+    if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
        logerror("inet socket setsockopt SO_REUSEADDR (%d)", errno);
        exit(1);
     }
@@ -128,7 +127,7 @@ player_new(int s, struct sockaddr_in *sin)
     struct hostent *hostp;
 #endif
 
-    lp = (struct player *)malloc(sizeof(struct player));
+    lp = malloc(sizeof(struct player));
     if (!lp)
       return NULL;
     memset(lp, 0, sizeof(struct player));
@@ -145,9 +144,8 @@ player_new(int s, struct sockaddr_in *sin)
        strcpy(lp->hostaddr, inet_ntoa(sin->sin_addr));
 #ifdef RESOLVE_IPADDRESS
        if (NULL !=
-           (hostp =
-            gethostbyaddr((char *)&sin->sin_addr, sizeof(sin->sin_addr),
-                          AF_INET)))
+           (hostp = gethostbyaddr(&sin->sin_addr, sizeof(sin->sin_addr),
+                                  AF_INET)))
            strcpy(lp->hostname, hostp->h_name);
 #endif /* RESOLVE_IPADDRESS */
        lp->cnum = 255;
@@ -170,7 +168,7 @@ player_delete(struct player *lp)
        io_close(lp->iop);
        lp->iop = 0;
     }
-    free((s_char *)lp);
+    free(lp);
     /* XXX may need to free bigmap here */
     return back;
 }
@@ -263,8 +261,7 @@ player_accept(void *unused)
            logerror("new socket accept");
            continue;
        }
-       (void)setsockopt(ns, SOL_SOCKET, SO_KEEPALIVE,
-                        (char *)&set, sizeof(set));
+       (void)setsockopt(ns, SOL_SOCKET, SO_KEEPALIVE, &set, sizeof(set));
        np = player_new(ns, &sin);
        if (!np) {
            logerror("can't create player for fd %d", ns);
index a016ef6c78f46b50c88c55b27371581bd8e91d81..015352cd8685cad806a32cc66a7e610691502013 100644 (file)
@@ -152,7 +152,7 @@ sanc_cmd(void)
     }
 
     snxtitem_all(&ni, EF_NATION);
-    while (nxtitem(&ni, (s_char *)&nat)) {
+    while (nxtitem(&ni, &nat)) {
        if (nat.nat_stat != (STAT_INUSE | STAT_SANCT))
            continue;
        if (first) {
index e61891a0e01ae4d72f6a499c7fe6fd4b104a370c..6ea14bfb4f1e28648fd504ec2fcbbdd90473f32f 100644 (file)
@@ -269,7 +269,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
     /* Go figure out if there are ships in this sector, and who's they are */
     memset(nats, 0, sizeof(nats));
     snxtitem_xy(&ni, EF_SHIP, x, y);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (mchr[(int)ship.shp_type].m_flags & M_SUB)
            continue;
        nats[ship.shp_own]++;
@@ -277,7 +277,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
     /* Go figure out if there are units in this sector, and who's they are */
     memset(lnats, 0, sizeof(lnats));
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_ship >= 0 || land.lnd_land >= 0)
            continue;
        lnats[land.lnd_own]++;
@@ -390,12 +390,12 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
            if (dplp->plane.pln_range <
                mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y)) {
                emp_remque(dqp);
-               free((s_char *)dqp);
+               free(dqp);
                continue;
            }
            if (mission_pln_equip(dplp, 0, P_F, 0) < 0) {
                emp_remque(dqp);
-               free((s_char *)dqp);
+               free(dqp);
                continue;
            }
            if (first) {
@@ -421,7 +421,7 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
            if (!(dplp->pcp->pl_flags & P_M))
                continue;
            emp_remque(dqp);
-           free((s_char *)dqp);
+           free(dqp);
            continue;
        }
     }
@@ -465,7 +465,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
            continue;
        if (mission_pln_equip(plp, 0, P_F, 0) < 0) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
        /* got one; delete from def_list, add to int_list */
@@ -746,11 +746,11 @@ ac_planedamage(struct plist *plp, natid from, int dam, natid other,
        pp->pln_own = 0;
        putplane(pp->pln_uid, pp);
        emp_remque(&plp->queue);
-       free((s_char *)plp);
+       free(plp);
     } else if (disp == 2) {
        putplane(pp->pln_uid, pp);
        emp_remque(&plp->queue);
-       free((s_char *)plp);
+       free(plp);
     } else
        putplane(pp->pln_uid, pp);
     strcpy(mesg, dmess);
@@ -813,7 +813,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
     memset(nats, 0, sizeof(nats));
     guns = 0;
     snxtitem_xy(&ni, EF_SHIP, x, y);
-    while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&ship)) {
+    while (!QEMPTY(list) && nxtitem(&ni, &ship)) {
        if (ship.shp_own == 0 || ship.shp_own == plane_owner)
            continue;
        if (guns >= 14)
@@ -881,7 +881,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
     memset(nats, 0, sizeof(nats));
     guns = 0;
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&land)) {
+    while (!QEMPTY(list) && nxtitem(&ni, &land)) {
        if (land.lnd_own == 0 || land.lnd_own == plane_owner)
            continue;
        if (guns >= 14)
@@ -1034,7 +1034,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
 
     emp_initque(list);
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own != own)
            continue;
        pcp = &plchr[(int)plane.pln_type];
@@ -1076,7 +1076,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
        if (ac_isflying(&plane, d))
            continue;
        /* got one! */
-       ip = (struct plist *)malloc(sizeof(*ip));
+       ip = malloc(sizeof(*ip));
        ip->state = P_OK;
        ip->bombs = 0;
        ip->misc = 0;
index f69581e098a272e823521b61e4894ffe4fa03d84..040b2423f4cec5d8cbce372dfe864dd9ff00b3c6 100644 (file)
@@ -1020,7 +1020,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
        maxland = def->shp_mcp->m_nland;
 
     snxtitem_xy(&ni, EF_LAND, off->x, off->y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own != player->cnum)
            continue;
        if (land.lnd_effic < LAND_MINEFF)
@@ -1111,7 +1111,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
                land_answer[(int)land.lnd_army] != 'Y')
                continue;
        }
-       if (!(llp = (struct llist *)malloc(sizeof(struct llist)))) {
+       if (!(llp = malloc(sizeof(struct llist)))) {
            logerror("Malloc failed in attack!\n");
            abort_attack();
            return;
@@ -1257,7 +1257,7 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
    lists.  Spies try to hide, trains get trapped and can be boarded. */
 
     snxtitem_xy(&ni, EF_LAND, def->x, def->y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!land.lnd_own)
            continue;
        if (land.lnd_own != def->own)
@@ -1276,7 +1276,7 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
                                            "Scouts report defending unit:");
            continue;
        }
-       if (!(llp = (struct llist *)malloc(sizeof(struct llist)))) {
+       if (!(llp = malloc(sizeof(struct llist)))) {
            logerror("Malloc failed in attack!\n");
            abort_attack();
            return 0;
@@ -1498,7 +1498,7 @@ put_land(struct emp_qelem *list)
        putland(llp->land.lnd_uid, &llp->land);
        if (llp->land.lnd_own != player->cnum) {
            emp_remque((struct emp_qelem *)llp);
-           free((s_char *)llp);
+           free(llp);
        } else
            get_land(A_ATTACK, 0, llp->land.lnd_uid, llp, 0);
     }
@@ -1543,7 +1543,7 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
     else
        dtotal = 0;
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land) &&
+    while (nxtitem(&ni, &land) &&
           (dtotal + new_land * eff < (int)(1.2 * (float)ototal))) {
        if (!land.lnd_own)
            continue;
index a5c66b265eb15346a73d02c00cfe5d21a14b9cb9..ac26d4f8bb64dc680401ce5d4e072438e3630c5e 100644 (file)
@@ -56,7 +56,7 @@ military_control(struct sctstr *sp)
 
     if (sp->sct_oldown != sp->sct_own) {
        snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
-       while (nxtitem(&ni, (s_char *)&land)) {
+       while (nxtitem(&ni, &land)) {
            if (land.lnd_own == sp->sct_own)
                tot_mil += total_mil(&land);
        }
index 5963763cc3966839275d48ef3a447235d7b35ea8..da37fde4924f9f60b4a78fa8460809c5fabc6e89 100644 (file)
@@ -54,7 +54,7 @@ shipsatxy(coord x, coord y, int wantflags, int nowantflags)
     first = 1;
     ships = 0;
     snxtitem_xy(&ni, EF_SHIP, x, y);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (player->owner)
            continue;
        if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
@@ -93,7 +93,7 @@ carriersatxy(coord x, coord y, int wantflags, int nowantflags, natid own)
     first = 1;
     ships = 0;
     snxtitem_xy(&ni, EF_SHIP, x, y);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
            continue;
        if (ship.shp_own != own
@@ -133,7 +133,7 @@ unitsatxy(coord x, coord y, int wantflags, int nowantflags)
     first = 1;
     units = 0;
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_effic < LAND_MINEFF || land.lnd_own == 0)
            continue;
        /* Can't bomb units on ships or other units */
@@ -179,7 +179,7 @@ planesatxy(coord x, coord y, int wantflags, int nowantflags,
     planes = 0;
     first = 1;
     snxtitem_xy(&ni, EF_PLANE, x, y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_effic < PLANE_MINEFF || plane.pln_own == 0)
            continue;
        if (plane.pln_flags & PLN_LAUNCHED)
@@ -220,7 +220,7 @@ asw_shipsatxy(coord x, coord y, int wantflags, int nowantflags,
     first = 1;
     ships = 0;
     snxtitem_xy(&ni, EF_SHIP, x, y);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (player->owner)
            continue;
        if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
@@ -261,7 +261,7 @@ num_shipsatxy(coord x, coord y, int wantflags, int nowantflags)
 
     ships = 0;
     snxtitem_xy(&ni, EF_SHIP, x, y);
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
            continue;
        mp = &mchr[(int)ship.shp_type];
index 979cf0fa78998ee1bcf975d37063607ac171e216..8ce218cf0a4a656422465e9c8f1987bb248fec46 100644 (file)
@@ -163,7 +163,7 @@ lnd_delete(struct llist *llp, s_char *s)
        lnd_print(llp, s);
     putland(llp->land.lnd_uid, &llp->land);
     emp_remque((struct emp_qelem *)llp);
-    free((s_char *)llp);
+    free(llp);
 }
 
 int
@@ -204,9 +204,8 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas)
 
     if (llp->land.lnd_effic < LAND_MINEFF) {
        sprintf(buf, "dies %s %s!",
-               combat_mode ? att_mode[combat_mode] : (s_char *)
-               "defending", xyas(llp->land.lnd_x, llp->land.lnd_y,
-                                 llp->land.lnd_own));
+               combat_mode ? att_mode[combat_mode] : "defending",
+               xyas(llp->land.lnd_x, llp->land.lnd_y, llp->land.lnd_own));
        lnd_delete(llp, buf);
        /* Since we killed the unit, we killed all the mil on it */
        return taken;
@@ -433,7 +432,7 @@ count_sect_units(struct sctstr *sp)
     struct lndstr land;
 
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!land.lnd_own)
            continue;
        if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y)
@@ -461,7 +460,7 @@ count_units(struct shpstr *sp)
        return;
 
     snxtitem_xy(&ni, EF_LAND, sp->shp_x, sp->shp_y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (land.lnd_ship == sp->shp_uid)
@@ -485,7 +484,7 @@ lnd_count_units(struct lndstr *lp)
        return;
 
     snxtitem_xy(&ni, EF_LAND, lp->lnd_x, lp->lnd_y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (land.lnd_land == lp->lnd_uid)
@@ -511,7 +510,7 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
     struct llist *llp;
 
     emp_initque(list);
-    while (nxtitem(ni, (s_char *)&land)) {
+    while (nxtitem(ni, &land)) {
        if (!player->owner)
            continue;
        if (opt_MARKET) {
@@ -546,7 +545,7 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
        land.lnd_harden = 0;
        memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
        putland(land.lnd_uid, &land);
-       llp = (struct llist *)malloc(sizeof(struct llist));
+       llp = malloc(sizeof(struct llist));
        llp->lcp = lcp;
        llp->land = land;
        llp->mobil = (double)land.lnd_mobil;
@@ -581,7 +580,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
            mpr(actor, "%s was disbanded at %s\n",
                prland(&land), xyas(land.lnd_x, land.lnd_y, land.lnd_own));
            emp_remque((struct emp_qelem *)llp);
-           free((s_char *)llp);
+           free(llp);
            continue;
        }
        if (land.lnd_ship >= 0) {
@@ -648,7 +647,7 @@ lnd_put(struct emp_qelem *list, natid actor)
        putland(llp->land.lnd_uid, &llp->land);
        newqp = qp->q_back;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
        qp = newqp;
     }
 }
@@ -764,11 +763,11 @@ lnd_check_mines(struct emp_qelem *land_list)
            lnd_hit_mine(&llp->land, llp->lcp);
            sect.sct_mines--;
            putsect(&sect);
-           putland(llp->land.lnd_uid, (s_char *)&llp->land);
+           putland(llp->land.lnd_uid, &llp->land);
            if (!llp->land.lnd_own) {
                stopping = 1;
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
            }
        }
     }
@@ -816,7 +815,7 @@ lnd_mess(s_char *str, struct llist *llp)
     llp->land.lnd_mobil = llp->mobil;
     putland(llp->land.lnd_uid, &llp->land);
     emp_remque((struct emp_qelem *)llp);
-    free((s_char *)llp);
+    free(llp);
 }
 
 static int
@@ -856,7 +855,7 @@ lnd_damage(struct emp_qelem *list, int totdam)
        putland(llp->land.lnd_uid, &llp->land);
        if (!llp->land.lnd_own) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
        }
     }
     return dam;
@@ -1254,7 +1253,7 @@ lnd_support(natid victim, natid attacker, coord x, coord y, int defending)
     double range, range2;
 
     snxtitem_all(&ni, EF_LAND);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_frg == 0)
            continue;
        if ((land.lnd_x == x) && (land.lnd_y == y))
@@ -1336,9 +1335,9 @@ lnd_path(int together, struct lndstr *lp, s_char *buf)
     }
     getsect(lp->lnd_x, lp->lnd_y, &sect);
     if (lchr[(int)lp->lnd_type].l_flags & L_TRAIN)
-       cp = (s_char *)BestLandPath(buf, &sect, &d_sect, &dummy, MOB_RAIL);
+       cp = BestLandPath(buf, &sect, &d_sect, &dummy, MOB_RAIL);
     else
-       cp = (s_char *)BestLandPath(buf, &sect, &d_sect, &dummy, MOB_ROAD);
+       cp = BestLandPath(buf, &sect, &d_sect, &dummy, MOB_ROAD);
     if (!cp) {
        pr("No owned path from %s to %s!\n",
           xyas(lp->lnd_x, lp->lnd_y, player->cnum),
index 82cfcece99b1fd372f12a1fbe6c2e1c22c73d56b..1a86976c0582346811fccaace6b87e3ce2249f7c 100644 (file)
@@ -309,7 +309,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
 /*
         size = max(sizeof(struct shpstr),sizeof(struct lndstr));
         size = max(size,sizeof(struct plnstr));
-        block = (s_char *)malloc(size);
+        block = malloc(size);
  */
     size = sizeof(u_block);
     block = (s_char *)&u_block;
@@ -360,7 +360,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
 
        if (opt_SLOW_WAR) {
            if (mission != MI_AIR_DEFENSE) {
-               getsect(x, y, (s_char *)&sect);
+               getsect(x, y, &sect);
                if (getrel(getnatp(gp->own), sect.sct_own) > AT_WAR) {
 
                    /*
@@ -377,7 +377,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
            }
        }
 
-       glp = (struct genlist *)malloc(sizeof(struct genlist));
+       glp = malloc(sizeof(struct genlist));
        memset(glp, 0, sizeof(struct genlist));
        glp->x = gp->x;
        glp->y = gp->y;
@@ -393,7 +393,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
            glp->cp = (s_char *)&plchr[(int)gp->type];
            break;
        }
-       glp->thing = (s_char *)malloc(size);
+       glp->thing = malloc(size);
        memcpy(glp->thing, block, size);
        emp_insque(&glp->queue, &mi[gp->own].queue);
     }
@@ -408,7 +408,7 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
     int dist;
 
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own != cn)
            continue;
 
@@ -420,7 +420,7 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
        if (dist > ((int)((float)plane.pln_range / 2.0)))
            continue;
 
-       plp = (struct plist *)malloc(sizeof(struct plist));
+       plp = malloc(sizeof(struct plist));
        memset(plp, 0, sizeof(struct plist));
        plp->pcp = &plchr[(int)plane.pln_type];
        plp->plane = plane;
@@ -656,7 +656,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
                    continue;
 
            /* save planes for later */
-           plp = (struct plist *)malloc(sizeof(struct plist));
+           plp = malloc(sizeof(struct plist));
 
            memset(plp, 0, sizeof(struct plist));
            plp->pcp = pcp;
@@ -689,7 +689,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
            qp = qp->q_forw;
 
            free(glp->thing);
-           free((s_char *)glp);
+           free(glp);
        }
        return dam;
     }
@@ -779,14 +779,14 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
        qp = qp->q_forw;
 
        free(glp->thing);
-       free((s_char *)glp);
+       free(glp);
     }
 
     qp = escorts.q_forw;
     while (qp != (&escorts)) {
        newqp = qp->q_forw;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
        qp = newqp;
     }
 
@@ -794,7 +794,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
     while (qp != (&bombers)) {
        newqp = qp->q_forw;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
        qp = newqp;
     }
 
@@ -906,7 +906,7 @@ show_mission(int type, struct nstr_item *np)
 
     size = max(sizeof(struct lndstr), sizeof(struct plnstr));
     size = max(size, sizeof(struct shpstr));
-    block = (s_char *)malloc(size);
+    block = malloc(size);
 
     while (nxtitem(np, block)) {
        gp = (struct genitem *)block;
@@ -1018,20 +1018,20 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
 
        if (pp->pln_effic < 40) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
 
        if (pp->pln_mobil < 1) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
 
        if (opt_MARKET) {
            if (ontradingblock(EF_PLANE, (int *)pp)) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
        }
@@ -1060,7 +1060,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
            }
            if (bad) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
            if (bad1 == 2) {
@@ -1074,7 +1074,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
            }
            if (bad1) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
        }
@@ -1089,7 +1089,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
            }
            if (bad) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
        }
@@ -1099,7 +1099,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
                pp->pln_effic = 0;
                putplane(pp->pln_uid, pp);
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
            if (!can_be_on_ship(pp->pln_uid, ship.shp_uid)) {
@@ -1113,7 +1113,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
                ((ship.shp_own != pp->pln_own) &&
                 (getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED))) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
        }
@@ -1123,7 +1123,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
                pp->pln_effic = 0;
                putplane(pp->pln_uid, pp);
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
            if (!(pcp->pl_flags & P_E))
@@ -1136,14 +1136,14 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
                ((land.lnd_own != pp->pln_own) &&
                 (getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED))) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
 
            /* Can't fly off units in ships or other units */
            if ((land.lnd_ship >= 0) || (land.lnd_land >= 0)) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
        }
@@ -1152,7 +1152,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
            /* If we can't get the sector, we can't check it, and can't fly */
            if (!getsect(pp->pln_x, pp->pln_y, &sect)) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
            /* First, check allied status */
@@ -1160,14 +1160,14 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
            if ((sect.sct_own != pp->pln_own) &&
                (getrel(getnatp(sect.sct_own), pp->pln_own) != ALLIED)) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
            /* non-vtol plane */
            if ((pcp->pl_flags & P_V) == 0) {
                if ((sect.sct_type != SCT_AIRPT) || (sect.sct_effic < 40)) {
                    emp_remque(qp);
-                   free((s_char *)qp);
+                   free(qp);
                    continue;
                }
            }
@@ -1175,7 +1175,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
        if (pcp->pl_flags & P_A) {
            if (roll(100) > pln_identchance(pp, hardtarget, EF_SHIP)) {
                emp_remque(qp);
-               free((s_char *)qp);
+               free(qp);
                continue;
            }
        }
@@ -1210,7 +1210,7 @@ mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
 
        if (mission_pln_equip(plp, ip, flags, mission) < 0) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
        if (flags & (P_S | P_I)) {
@@ -1371,7 +1371,7 @@ add_airport(struct emp_qelem *airp, coord x, coord y)
     struct airport *a;
     struct sctstr sect;
 
-    a = (struct airport *)malloc(sizeof(struct airport));
+    a = malloc(sizeof(struct airport));
 
     a->x = x;
     a->y = y;
@@ -1554,7 +1554,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
 
            dist = mapdist(x, y, gp->x, gp->y);
 
-           plp = (struct plist *)malloc(sizeof(struct plist));
+           plp = malloc(sizeof(struct plist));
            memset(plp, 0, sizeof(struct plist));
            plp->pcp = (struct plchrstr *)glp->cp;
            memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
@@ -1594,7 +1594,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
                /* Free it up and continue */
                emp_remque(qp);
                glp = (struct genlist *)qp;
-               free((s_char *)glp);
+               free(glp);
            }
        }
 
@@ -1704,7 +1704,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
            next = qp->q_forw;
            glp = (struct genlist *)qp;
            free(glp->thing);
-           free((s_char *)glp);
+           free(glp);
        }
     }
 
index 81ff012437db5331f37e492afe2899d23e7341f0..9153f61d99828bbbabae84e35ac0e52aa0a6ec29 100644 (file)
@@ -175,7 +175,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
 
     emp_initque(list);
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (!plane.pln_own)
            continue;
 
@@ -198,7 +198,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
        if (plane.pln_effic < 100)
            continue;
        /* got a valid interceptor */
-       irv = (struct plist *)malloc(sizeof(*irv));
+       irv = malloc(sizeof(*irv));
        irv->state = P_OK;
        irv->bombs = 0;
        irv->misc = 0;
@@ -267,7 +267,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        pcp = ip->pcp;
        if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
        /* got one interceptor, delete from irv_list and
@@ -286,7 +286,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        pcp = ip->pcp;
        if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
        /* got one interceptor, delete from irv_list and
@@ -301,7 +301,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
     while (!QEMPTY(irvlist)) {
        qp = irvlist->q_forw;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
     }
     if (icount == 0) {
        if (sect.sct_own != 0)
@@ -348,7 +348,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        pp->pln_own = 0;
        putplane(pp->pln_uid, pp);
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
        if (destroyed)
            break;
     }
@@ -356,7 +356,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
     while (!QEMPTY(intlist)) {
        qp = intlist->q_forw;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
     }
     if (destroyed)
        return (destroyed);
index c744661f6a332a429482b1af048103a933511e84..71a41eb61194d8697a624390e3603aff521deb59 100644 (file)
@@ -339,7 +339,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
     unsigned int x;
 
     emp_initque(list);
-    while (nxtitem(ni, (s_char *)&plane)) {
+    while (nxtitem(ni, &plane)) {
        if (!player->owner)
            continue;
        if (plane.pln_mobil <= 0)
@@ -503,7 +503,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
        pr("%s standing by\n", prplane(&plane));
        plane.pln_mission = 0;
        putplane(plane.pln_uid, &plane);
-       plp = (struct plist *)malloc(sizeof(struct plist));
+       plp = malloc(sizeof(struct plist));
        plp->state = P_OK;
        plp->misc = 0;
        plp->bombs = 0;
@@ -526,7 +526,7 @@ pln_arm(struct emp_qelem *list, int dist, int mission, struct ichrstr *ip,
        plp = (struct plist *)qp;
        if (pln_equip(plp, ip, flags, mission) < 0) {
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
            continue;
        }
        if (flags & (P_S | P_I)) {
@@ -732,7 +732,7 @@ pln_put(struct emp_qelem *list)
        putplane(pp->pln_uid, pp);
        newqp = qp->q_forw;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
        qp = newqp;
     }
 }
@@ -759,7 +759,7 @@ pln_removedupes(struct emp_qelem *bomb_list, struct emp_qelem *esc_list)
            escp = (struct plist *)esc;
            if (escp->plane.pln_uid == bombp->plane.pln_uid) {
                emp_remque(esc);
-               free((s_char *)esc);
+               free(esc);
                esc = esc_list;
            } else
                esc = esc->q_forw;
@@ -991,7 +991,7 @@ count_planes(struct shpstr *sp)
 
     mcp = &mchr[(int)sp->shp_type];
     snxtitem_xy(&ni, EF_PLANE, sp->shp_x, sp->shp_y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        if (plane.pln_ship == sp->shp_uid) {
@@ -1025,7 +1025,7 @@ count_land_planes(struct lndstr *lp)
        return;
 
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == 0)
            continue;
        if (plane.pln_land == lp->lnd_uid)
@@ -1046,7 +1046,7 @@ count_sect_planes(struct sctstr *sp)
     struct plnstr plane;
 
     snxtitem_all(&ni, EF_PLANE);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (!plane.pln_own)
            continue;
        if (plane.pln_flags & PLN_LAUNCHED)
index 8ea260c6a221815ff31467b02eeaedbd6a6f95bf..a5dd8c7f38cabdeb73c951640a9920f14e7f38b8 100644 (file)
@@ -246,7 +246,7 @@ pr_hilite(s_char *buf)
     register s_char c;
     s_char *p;
 
-    p = (s_char *)malloc(strlen(buf) + 1);
+    p = malloc(strlen(buf) + 1);
     strcpy(p, buf);
     for (bp = p; 0 != (c = *bp); bp++)
        if (isprint(c))
index b17d2801309b8db5a9da485f65606d3eecf818c2..c3e565db7934acc6f4a9c1ea973f7ba4fa7db7eb 100644 (file)
@@ -87,20 +87,20 @@ radmap2(int owner,
     int changed = 0;
 
     if (!radbuf)
-       radbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
+       radbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
                                  sizeof(s_char));
     if (!visbuf)
-       visbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
+       visbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
                                  sizeof(s_char));
     if (!rad) {
-       rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       rad = malloc(WORLD_Y * sizeof(s_char *));
        if (rad && radbuf) {
            for (x = 0; x < WORLD_Y; x++)
                rad[x] = &radbuf[(WORLD_X + 1) * x];
        }
     }
     if (!vis) {
-       vis = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       vis = malloc(WORLD_Y * sizeof(s_char *));
        if (vis && visbuf) {
            for (x = 0; x < WORLD_Y; x++)
                vis[x] = &visbuf[(WORLD_X + 1) * x];
index 0ed67b0bb8173e92239c02d4398071fd64450a1f..99b0cdd9dbf9a0343ba5459d88156e72430b6a02 100644 (file)
@@ -101,7 +101,7 @@ retreat_ship(struct shpstr *sp, s_char code)
        buf[0] = sp->shp_fleet;
        buf[1] = 0;
        snxtitem(&ni, EF_SHIP, buf);
-       while (nxtitem(&ni, (s_char *)&ship))
+       while (nxtitem(&ni, &ship))
            if ((ship.shp_fleet == buf[0]) &&
                (ship.shp_own == sp->shp_own)) {
                if (ship.shp_uid == sp->shp_uid) {
@@ -402,7 +402,7 @@ retreat_land(struct lndstr *lp, s_char code)
        buf[0] = lp->lnd_army;
        buf[1] = 0;
        snxtitem(&ni, EF_SHIP, buf);
-       while (nxtitem(&ni, (s_char *)&land))
+       while (nxtitem(&ni, &land))
            if ((land.lnd_army == buf[0]) && (land.lnd_own == lp->lnd_own)) {
                if (land.lnd_uid == lp->lnd_uid) {
                    retreat_land1(lp, code, 1);
index 4e95a1c36e6a8097d06c2650cce9b44ff0ce6a1b..569a5637a1c80764da4dcf4b18f583240be0969f 100644 (file)
@@ -70,10 +70,10 @@ satmap(int x, int y, int eff, int range, int flags, int type)
        return;
 
     if (!radbuf)
-       radbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
+       radbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
                                  sizeof(s_char));
     if (!rad) {
-       rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       rad = malloc(WORLD_Y * sizeof(s_char *));
        if (rad && radbuf) {
            for (rx = 0; rx < WORLD_Y; rx++)
                rad[rx] = &radbuf[(WORLD_X + 1) * rx];
index 4b0533b1f8e68029b11cfdfa98959c7c3d847d9d..27e8296de367319cf02d1e6785b88b8a5cd4387e 100644 (file)
@@ -71,7 +71,7 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
     struct mlist *mlp;
 
     emp_initque(list);
-    while (nxtitem(ni, (s_char *)&ship)) {
+    while (nxtitem(ni, &ship)) {
        if (!player->owner)
            continue;
        mcp = &mchr[(int)ship.shp_type];
@@ -103,7 +103,7 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
        ship.shp_rflags = 0;
        memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
        putship(ship.shp_uid, &ship);
-       mlp = (struct mlist *)malloc(sizeof(struct mlist));
+       mlp = malloc(sizeof(struct mlist));
        mlp->mcp = mcp;
        mlp->ship = ship;
        mlp->mobil = (double)ship.shp_mobil;
@@ -136,7 +136,7 @@ shp_nav(struct emp_qelem *list, double *minmobp, double *maxmobp,
            mpr(actor, "%s was sunk at %s\n",
                prship(&ship), xyas(ship.shp_x, ship.shp_y, actor));
            emp_remque((struct emp_qelem *)mlp);
-           free((s_char *)mlp);
+           free(mlp);
            continue;
        }
        if (opt_SAIL) {
@@ -203,7 +203,7 @@ shp_put(struct emp_qelem *list, natid actor)
        putship(mlp->ship.shp_uid, &mlp->ship);
        newqp = qp->q_back;
        emp_remque(qp);
-       free((s_char *)qp);
+       free(qp);
        qp = newqp;
     }
 }
@@ -264,7 +264,7 @@ shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor)
        if (shp_check_one_mines(mlp)) {
            stopping = 1;
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
        }
        putship(mlp->ship.shp_uid, &mlp->ship);
        putsect(&sect);
@@ -294,7 +294,7 @@ shp_check_one_mines(struct mlist *mlp)
        if (changed)
            writemap(actor);
        putsect(&sect);
-       putship(mlp->ship.shp_uid, (s_char *)&mlp->ship);
+       putship(mlp->ship.shp_uid, &mlp->ship);
        if (!mlp->ship.shp_own)
            return 1;
     }
@@ -315,7 +315,7 @@ shp_check_mines(struct emp_qelem *ship_list)
        if (shp_check_one_mines(mlp)) {
            stopping = 1;
            emp_remque(qp);
-           free((s_char *)qp);
+           free(qp);
        }
     }
     return stopping;
@@ -363,7 +363,7 @@ shp_mess(s_char *str, struct mlist *mlp)
     mlp->ship.shp_mobil = (int)mlp->mobil;
     putship(mlp->ship.shp_uid, &mlp->ship);
     emp_remque((struct emp_qelem *)mlp);
-    free((s_char *)mlp);
+    free(mlp);
 }
 
 static int
@@ -417,7 +417,7 @@ shp_damage_one(struct mlist *mlp, int dam)
     putship(mlp->ship.shp_uid, &mlp->ship);
     if (!mlp->ship.shp_own) {
        emp_remque((struct emp_qelem *)mlp);
-       free((s_char *)mlp);
+       free(mlp);
     }
 }
 
@@ -1008,8 +1008,8 @@ shp_path(int together, struct shpstr *shp, s_char *buf)
        return 0;
     }
 
-    cp = (s_char *)BestShipPath(buf, shp->shp_x, shp->shp_y,
-                               d_sect.sct_x, d_sect.sct_y, player->cnum);
+    cp = BestShipPath(buf, shp->shp_x, shp->shp_y,
+                     d_sect.sct_x, d_sect.sct_y, player->cnum);
     if (!cp || shp->shp_mobil <= 0) {
        mpr(shp->shp_own, "Can't get to '%s' right now.\n",
            xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
@@ -1029,7 +1029,7 @@ shp_missdef(struct shpstr *sp, natid victim)
 
     emp_initque(&list);
 
-    mlp = (struct mlist *)malloc(sizeof(struct mlist));
+    mlp = malloc(sizeof(struct mlist));
     mlp->mcp = &mchr[(int)sp->shp_type];
     mlp->ship = *sp;
     mlp->mobil = (double)sp->shp_mobil;
index fcf42f1ccdc1351b10ade94a95b0779089aa1592..8741657d66f18271a20c3b245fa7dc94e4c74446 100644 (file)
@@ -262,7 +262,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
     /* look for an owned ship in a harbor */
     snxtitem_dist(&ni, EF_SHIP, x, y, lookrange);
 
-    while (nxtitem(&ni, (s_char *)&ship) && wanted) {
+    while (nxtitem(&ni, &ship) && wanted) {
        if (ship.shp_own != own)
            continue;
 
@@ -335,7 +335,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
     /* look for an owned supply unit */
     snxtitem_dist(&ni, EF_LAND, x, y, lookrange);
 
-    while (nxtitem(&ni, (s_char *)&land) && wanted) {
+    while (nxtitem(&ni, &land) && wanted) {
        int min;
 
        if (land.lnd_own != own)
index 72cbdd26f6dd04addb6264f86d0aa90c66c82657..eaf98a0ef1276ef5289a546370185d5fca2e924b 100644 (file)
@@ -139,7 +139,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
        pr("] #%d", tp->trd_unitid);
        if (opt_SHOWPLANE) {
            snxtitem_all(&ni, EF_PLANE);
-           while (nxtitem(&ni, (s_char *)&plane)) {
+           while (nxtitem(&ni, &plane)) {
                if (plane.pln_ship == sp->shp_uid && plane.pln_own != 0) {
                    pr("\n\t\t\t\t    tech %3d %3d%% %s #%d",
                       plane.pln_tech,
@@ -151,7 +151,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
                }
            }
            snxtitem_all(&ni, EF_LAND);
-           while (nxtitem(&ni, (s_char *)&land)) {
+           while (nxtitem(&ni, &land)) {
                if (land.lnd_ship == sp->shp_uid && land.lnd_own != 0) {
                    pr("\n\t\t\t\t    tech %3d %3d%% %s #%d",
                       land.lnd_tech,
@@ -159,7 +159,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
                       lchr[(int)land.lnd_type].l_name, land.lnd_uid);
                    if (land.lnd_nxlight) {
                        snxtitem_all(&ni, EF_PLANE);
-                       while (nxtitem(&ni, (s_char *)&plane)) {
+                       while (nxtitem(&ni, &plane)) {
                            if (plane.pln_land == land.lnd_uid) {
                                pr("\n\t\t\t\t    tech %3d %3d%% %s #%d",
                                   plane.pln_tech,
@@ -197,7 +197,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
        pr("] #%d", tp->trd_unitid);
        if (opt_SHOWPLANE) {
            snxtitem_all(&ni, EF_PLANE);
-           while (nxtitem(&ni, (s_char *)&plane)) {
+           while (nxtitem(&ni, &plane)) {
                if (plane.pln_land == lp->lnd_uid && plane.pln_own != 0) {
                    pr("\n\t\t\t\t    tech %3d %3d%% %s #%d",
                       plane.pln_tech,
@@ -233,7 +233,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
 int
 trade_getitem(struct trdstr *tp, union trdgenstr *tgp)
 {
-    if (!ef_read(tp->trd_type, tp->trd_unitid, (s_char *)tgp))
+    if (!ef_read(tp->trd_type, tp->trd_unitid, tgp))
        return 0;
     return 1;
 }
index dfd9c479829e20850ddd830025a841a2e2b36016..c463fd449be5597a33ede39ebab2e85e7c6ec0bb 100644 (file)
@@ -72,7 +72,7 @@ trechk(register natid actor, register natid victim, int provision)
     for (cn = 0; cn < MAXNOC; cn++)
        involved[cn] = 0;
     snxtitem_all(&nstr, EF_TREATY);
-    while (nxtitem(&nstr, (s_char *)&treaty)) {
+    while (nxtitem(&nstr, &treaty)) {
        if (treaty.trt_status == TS_FREE)
            continue;
        if (treaty.trt_exp < now)
index 36fbe08f795a4b82ab775976026a6c4b9f86c045..baf202c225e0f46bef4b7c5b689eec58ffb558d5 100644 (file)
@@ -148,7 +148,7 @@ finish_sects(int etu)
        if (sp->sct_type == SCT_WATER || sp->sct_own == 0) {
 #ifdef SAVE_FINISH_PATHS
            if (infptr->path)
-               free((s_char *)infptr->path);
+               free(infptr->path);
 #endif /* SAVE_FINISH_PATHS */
            continue;
        }
@@ -156,7 +156,7 @@ finish_sects(int etu)
        if (np->nat_money < 0) {
 #ifdef SAVE_FINISH_PATHS
            if (infptr->path)
-               free((s_char *)infptr->path);
+               free(infptr->path);
 #endif /* SAVE_FINISH_PATHS */
            continue;
        }
@@ -164,7 +164,7 @@ finish_sects(int etu)
                     infptr->path, infptr->imcost, infptr->excost);
 #ifdef SAVE_FINISH_PATHS
        if (infptr->path)
-           free((s_char *)infptr->path);
+           free(infptr->path);
 #endif /* SAVE_FINISH_PATHS */
     }
     logerror("done importing\n");
@@ -205,7 +205,7 @@ assemble_dist_paths(struct distinfo *distptrs)
            int len;
            /* Here we malloc a buffer and save it */
            len = strlen(path);
-           infptr->path = (s_char *)malloc(len);
+           infptr->path = malloc(len);
            if (infptr->path == (s_char *)0) {
                logerror("malloc failed in assemble_dist_path!\n");
                return;
index 3409df836081843b9313b966d0866402eb063aee..0c265e2dacd70fd4b1be5b59aecaf2dc6416e31c 100644 (file)
@@ -95,7 +95,7 @@ update_main(void *unused)
     memset(air_money, 0, sizeof(air_money));
     memset(sea_money, 0, sizeof(sea_money));
     memset(lnd_money, 0, sizeof(lnd_money));
-    bp = (int *)calloc(WORLD_X * WORLD_Y * 7, sizeof(int));
+    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)
index d808d6035dfe545f58c73485603fabae70f4550c..ee38cb96a2fa7ad3bee984fe7ed5461cf1300f73 100644 (file)
@@ -258,7 +258,7 @@ nav_ship(struct shpstr *sp)
 
     /* Make a list of one ships so we can use the navi.c code */
     emp_initque(&ship_list);
-    mlp = (struct mlist *)malloc(sizeof(struct mlist));
+    mlp = malloc(sizeof(struct mlist));
     mlp->mcp = mchr + sp->shp_type;
     mlp->ship = *sp;
     mlp->mobil = (double)sp->shp_mobil;
index 339d6897b003186b7e1705cb52b9c20ea93d0427..a16931aed66c7c75b47200e88d089e03ed87ecc8 100644 (file)
@@ -167,7 +167,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
         fltp = fltp->next) ;
 
     if (!fltp) {
-       fltp = (struct fltheadstr *)malloc(sizeof(*fltp));
+       fltp = malloc(sizeof(*fltp));
        memset(fltp, 0, sizeof(*fltp));
 
        /* Fix the links. */
@@ -192,7 +192,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
        return (0);
     }
 
-    this = (struct fltelemstr *)malloc(sizeof(*this));
+    this = malloc(sizeof(*this));
     memset(this, 0, sizeof(*this));
     this->num = sp->shp_uid;
     this->own = sp->shp_own;
@@ -338,7 +338,7 @@ fltp_to_list(struct fltheadstr *fltp, struct emp_qelem *list)
 
     emp_initque(list);
     for (fe = fltp->head; fe; fe = fe->next) {
-       mlp = (struct mlist *)malloc(sizeof(struct mlist));
+       mlp = malloc(sizeof(struct mlist));
        sp = getshipp(fe->num);
        mlp->mcp = mchr + sp->shp_type;
        mlp->ship = *sp;
index e4b80ffda3121c0ea77f60f8236e79b17882635f..088aca3c901b5242e4b7cf11b6792f89dd361c57 100644 (file)
@@ -439,37 +439,36 @@ allocate_memory(void)
        return -1;
     }
     free(fname);
-    sectsbuf =
-       (struct sctstr *)calloc((YSIZE * XSIZE), sizeof(struct sctstr));
-    sects = (struct sctstr **)calloc(YSIZE, sizeof(struct sctstr *));
+    sectsbuf = calloc((YSIZE * XSIZE), sizeof(struct sctstr));
+    sects = calloc(YSIZE, sizeof(struct sctstr *));
     for (i = 0; i < YSIZE; i++)
        sects[i] = &sectsbuf[XSIZE * i];
-    capx = (int *)calloc(nc, sizeof(int));
-    capy = (int *)calloc(nc, sizeof(int));
-    vector = (int *)calloc(WORLD_X + WORLD_Y, sizeof(int));
-    mc = (int *)calloc(STABLE_CYCLE, sizeof(int));
-    own = (int **)calloc(WORLD_X, sizeof(int *));
-    elev = (int **)calloc(WORLD_X, sizeof(int *));
+    capx = calloc(nc, sizeof(int));
+    capy = calloc(nc, sizeof(int));
+    vector = calloc(WORLD_X + WORLD_Y, sizeof(int));
+    mc = calloc(STABLE_CYCLE, sizeof(int));
+    own = calloc(WORLD_X, sizeof(int *));
+    elev = calloc(WORLD_X, sizeof(int *));
     for (i = 0; i < WORLD_X; ++i) {
-       own[i] = (int *)calloc(WORLD_Y, sizeof(int));
-       elev[i] = (int *)calloc(WORLD_Y, sizeof(int));
+       own[i] = calloc(WORLD_Y, sizeof(int));
+       elev[i] = calloc(WORLD_Y, sizeof(int));
     }
-    sectx = (int **)calloc(nc + ni, sizeof(int *));
-    secty = (int **)calloc(nc + ni, sizeof(int *));
-    sectc = (int **)calloc(nc + ni, sizeof(int *));
-    isecs = (int *)calloc(nc + ni, sizeof(int));
-    weight = (int *)calloc(max(sc, is * 2), sizeof(int));
-    dsea = (int *)calloc(max(sc, is * 2), sizeof(int));
-    dmoun = (int *)calloc(max(sc, is * 2), sizeof(int));
+    sectx = calloc(nc + ni, sizeof(int *));
+    secty = calloc(nc + ni, sizeof(int *));
+    sectc = calloc(nc + ni, sizeof(int *));
+    isecs = calloc(nc + ni, sizeof(int));
+    weight = calloc(max(sc, is * 2), sizeof(int));
+    dsea = calloc(max(sc, is * 2), sizeof(int));
+    dmoun = calloc(max(sc, is * 2), sizeof(int));
     for (i = 0; i < nc; ++i) {
-       sectx[i] = (int *)calloc(sc, sizeof(int));
-       secty[i] = (int *)calloc(sc, sizeof(int));
-       sectc[i] = (int *)calloc(sc, sizeof(int));
+       sectx[i] = calloc(sc, sizeof(int));
+       secty[i] = calloc(sc, sizeof(int));
+       sectc[i] = calloc(sc, sizeof(int));
     }
     for (i = nc; i < nc + ni; ++i) {
-       sectx[i] = (int *)calloc(is * 2, sizeof(int));
-       secty[i] = (int *)calloc(is * 2, sizeof(int));
-       sectc[i] = (int *)calloc(is * 2, sizeof(int));
+       sectx[i] = calloc(is * 2, sizeof(int));
+       secty[i] = calloc(is * 2, sizeof(int));
+       sectc[i] = calloc(is * 2, sizeof(int));
     }
 
     return 0;
@@ -1163,10 +1162,10 @@ translate_continents(void)
     int i, j, n = 0, k, gotit, c;
     int *trans, *trans_cont, *oldcapx, *oldcapy;
 
-    trans = (int *)calloc(nc, sizeof(int));
-    trans_cont = (int *)calloc(nc, sizeof(int));
-    oldcapx = (int *)calloc(nc, sizeof(int));
-    oldcapy = (int *)calloc(nc, sizeof(int));
+    trans = calloc(nc, sizeof(int));
+    trans_cont = calloc(nc, sizeof(int));
+    oldcapx = calloc(nc, sizeof(int));
+    oldcapy = calloc(nc, sizeof(int));
 
     for (i = 0; i < WORLD_Y; ++i) {
        for (j = i % 2; j < WORLD_X; j += 2) {
index 04e866b4fbb5b2b7b41a36daca8dc40b9d239ec0..e9f1685dd5664475251f7235a72932697e035db1 100644 (file)
@@ -174,11 +174,11 @@ main(int argc, char *argv[])
            putsect(&sct);
        }
     }
-    map = (s_char *)calloc(WORLD_X * WORLD_Y / 2, sizeof(*map));
+    map = calloc(WORLD_X * WORLD_Y / 2, sizeof(*map));
     for (i = 0; i < MAXNOC; i++) {
        ef_write(EF_MAP, i, map);
     }
-    map = (s_char *)calloc(WORLD_X * WORLD_Y / 2, sizeof(*map));
+    map = calloc(WORLD_X * WORLD_Y / 2, sizeof(*map));
     for (i = 0; i < MAXNOC; i++) {
        ef_write(EF_BMAP, i, map);
     }