]> git.pond.sub.org Git - empserver/commitdiff
(bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 8 Jan 2004 17:54:28 +0000 (17:54 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 8 Jan 2004 17:54:28 +0000 (17:54 +0000)
effect.  Replace calls by struct assignment where possible.  Replace
clear buffer, copy string to buffer by strncpy().  Use assignment to
clear when that's clearer.  Replace overlapping copy through bounce
buffer by memmove().  Replace rest by standard memset() and memcpy().
Also use sizeof() instead of literal array sizes for robustness, and
instead of symbolic array sizes for clarity.

79 files changed:
include/misc.h
src/client/host.c
src/client/hpux.c
src/client/ioqueue.c
src/client/login.c
src/client/main.c
src/lib/as/as_cache.c
src/lib/commands/add.c
src/lib/commands/army.c
src/lib/commands/bomb.c
src/lib/commands/budg.c
src/lib/commands/buil.c
src/lib/commands/cede.c
src/lib/commands/coll.c
src/lib/commands/cons.c
src/lib/commands/edit.c
src/lib/commands/expl.c
src/lib/commands/flee.c
src/lib/commands/head.c
src/lib/commands/look.c
src/lib/commands/mfir.c
src/lib/commands/move.c
src/lib/commands/navi.c
src/lib/commands/new.c
src/lib/commands/news.c
src/lib/commands/path.c
src/lib/commands/powe.c
src/lib/commands/rea.c
src/lib/commands/repo.c
src/lib/commands/retr.c
src/lib/commands/rout.c
src/lib/commands/sail.c
src/lib/commands/scra.c
src/lib/commands/sect.c
src/lib/commands/sona.c
src/lib/commands/spy.c
src/lib/commands/surv.c
src/lib/commands/torp.c
src/lib/commands/wipe.c
src/lib/common/file.c
src/lib/common/maps.c
src/lib/common/path.c
src/lib/common/snxtit_subs.c
src/lib/common/snxtsct_subs.c
src/lib/gen/copy.c
src/lib/gen/ioqueue.c
src/lib/lwp/arch.c
src/lib/lwp/sel.c
src/lib/player/accept.c
src/lib/subs/aircombat.c
src/lib/subs/aswplnsubs.c
src/lib/subs/attsub.c
src/lib/subs/land.c
src/lib/subs/lndsub.c
src/lib/subs/mission.c
src/lib/subs/move.c
src/lib/subs/mslsub.c
src/lib/subs/nuke.c
src/lib/subs/plane.c
src/lib/subs/plnsub.c
src/lib/subs/radmap.c
src/lib/subs/retreat.c
src/lib/subs/satmap.c
src/lib/subs/ship.c
src/lib/subs/shpsub.c
src/lib/subs/supply.c
src/lib/subs/takeover.c
src/lib/update/finish.c
src/lib/update/land.c
src/lib/update/main.c
src/lib/update/nat.c
src/lib/update/nav_ship.c
src/lib/update/plague.c
src/lib/update/plane.c
src/lib/update/prepare.c
src/lib/update/sail.c
src/lib/update/ship.c
src/util/files.c
src/util/ore.c

index b6fb7000ebc2596fa074e4413358ea1124225f5e..1e841142df3500be592949eaec935d9a03cc83b2 100644 (file)
@@ -54,9 +54,6 @@ typedef unsigned int u_int;
 /* integral mismatch, due to misuse of sector short */
 #pragma warning (disable : 4761 )
 
-#define bzero(d, s) memset(d, 0, s)
-#define bcopy(s, d, z) memcpy(d, s, z)
-
 #include <minmax.h>
 #include <io.h>
 
index 5f308315eb9524ace4a740873c0524ca5e794540..fe66d6cc11e5d46aa8f2bea25faeea6d54532b49 100644 (file)
@@ -65,8 +65,7 @@ struct sockaddr_in *addr;
            fprintf(stderr, "%s: No such host\n", name);
            return 0;
        }
-       bcopy(hp->h_addr, (s_char *)&addr->sin_addr,
-             sizeof(addr->sin_addr));
+       memcpy(&addr->sin_addr, hp->h_addr, sizeof(addr->sin_addr));
 #ifdef _WIN32
        printf("Trying to connect to '%s'\n", inet_ntoa(addr->sin_addr));
        fflush(stdout);
index 49bfac52417d1b608a2bec76637398857410c13f..8071530f05d71ab286e3859349c3cdbffec94619 100644 (file)
@@ -63,18 +63,4 @@ register int c;
     return NULL;
 }
 
-bzero(ptr, len)
-s_char *ptr;
-int len;
-{
-    memset(ptr, 0, len);
-}
-
-bcopy(src, dst, len)
-s_char *src;
-s_char *dst;
-int len;
-{
-    memcpy(dst, src, len);
-}
 #endif
index 7e084fb386d66b9523e3538d9cc6367aa4b47a47..fd7babb44ffd6e5f52ffa00608d3c492ff3d4a01 100644 (file)
@@ -218,7 +218,7 @@ int cc;
        if (nbytes > 0) {
            if (nleft < nbytes)
                nbytes = nleft;
-           bcopy(io->data + io->offset, offset, nbytes);
+           memcpy(offset, io->data + io->offset, nbytes);
            offset += nbytes;
            nleft -= nbytes;
        }
index 46ca38379a995fbd2b5f061d1de2755c80bb2018..cd95f5f269d9f56d210fe112fcdd8139485ce49b 100644 (file)
@@ -96,7 +96,7 @@ int kill_proc;
     }
     (void)printf("\n");
     (void)sendcmd(s, PASS, cpass);
-    bzero(cpass, strlen(cpass));       /* for core dumps */
+    memset(cpass, 0, strlen(cpass));   /* for core dumps */
     if (!expect(s, C_CMDOK, buf)) {
        (void)fprintf(stderr, "Bad password\n");
        return 0;
index ed8e4db40989db066a283b2a7183e8e3bb6d6244..80821f67d92d827fc39a5e5d73357a729e2abe93 100644 (file)
@@ -101,26 +101,6 @@ char c;
     return (s_char *)0;
 }
 
-bzero(ptr, size)
-s_char *ptr;
-int size;
-{
-    int i;
-
-    for (i = 0; i < size; i++)
-       ptr[i] = 0;
-}
-
-bcopy(src, dest, size)
-unsigned char *src, *dest;
-int size;
-{
-    int i;
-    unsigned char *d = dest, *s = src;
-
-    for (i = 0; i < size; i++)
-       *d++ = *s++;
-}
 #endif
 
 int
@@ -171,7 +151,7 @@ s_char *av[];
     mask = bit_newfdmask();
     savemask = bit_newfdmask();
 #endif
-    bzero((s_char *)argv, sizeof(argv));
+    memset(argv, 0, sizeof(argv));
     saveargv(ac, av, argv);
     auxout_fname = 0;
     auxout_fp = 0;
index dbfa266b5df75c8a472097d094b862071fb638a4..c3a12cf6d9d621e108c2c1b6751a3767df7dbbbc 100644 (file)
@@ -166,7 +166,7 @@ as_clear_cachepath()
     }
     /* Note we don't free the fromhead here, we just zero it.  That way,
        we can use it next time without mallocing int */
-    bzero((s_char *)fromhead, (sizeof(struct as_frompath *) * WORLD_Y));
+    memset(fromhead, 0, (sizeof(struct as_frompath *) * WORLD_Y));
 }
 
 struct as_path *
index 91e736cd3ed9394ab693279e936e839e149e5dab..53090a4b4dbbdf38b9981a99d6b7899c4c8db69d 100644 (file)
@@ -207,7 +207,7 @@ add(void)
        natp->nat_xorg = 0;
        natp->nat_dayno = 0;
        natp->nat_minused = 0;
-       bzero((s_char *)natp->nat_b, sizeof(natp->nat_b));
+       memset(natp->nat_b, 0, sizeof(natp->nat_b));
        (void)time(&natp->nat_last_login);
        (void)time(&natp->nat_last_logout);
        natp->nat_money = 0;
index 7da80b4f6120dc288b4cb63619054bfb7e17f656..77dfbfd32b89eabe4efca05dd3322c6e7c096024 100644 (file)
@@ -76,7 +76,7 @@ army(void)
        while ((r = nxtitem(&ni, (s_char *)&land2)) &&
               (land2.lnd_army != c)) ;
        if (r) {
-           bcopy(land2.lnd_rpath, land.lnd_rpath, 10);
+           memcpy(land.lnd_rpath, land2.lnd_rpath, sizeof(land.lnd_rpath));
            land.lnd_rflags = land2.lnd_rflags;
        }
        putland(land.lnd_uid, &land);
index 1cf4832d02e6caf54cd3bb13a558acc41209e5dd..2a8ecaa6516e83cfe5c6b3a445d21ef25f8dbadc 100644 (file)
@@ -523,7 +523,7 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
     int gun;
     int shell;
 
-    bzero((s_char *)&head, sizeof(struct shiplook));
+    memset(&head, 0, sizeof(struct shiplook));
     head.uid = -1;
     onsea = (target->sct_type == SCT_WATER) ? 1 : 0;
     for (qp = list->q_forw; qp != list && !player->aborted;
@@ -536,7 +536,7 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
                free(s2);
            }
        }
-       bzero((s_char *)&head, sizeof(struct shiplook));
+       memset(&head, 0, sizeof(struct shiplook));
        head.uid = -1;
        plp = (struct plist *)qp;
        if ((plp->pcp->pl_flags & P_C) && (!(plp->pcp->pl_flags & P_T)))
@@ -963,7 +963,7 @@ pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp, natid from,
     eff = pp->pln_effic;
     if (dam <= 0)
        return 0;
-    bzero(dmess, 255);
+    memset(dmess, 0, sizeof(dmess));
     eff -= dam;
     if (eff < 0)
        eff = 0;
index 66046bdd3d508825b8bfc32b15879f12b3b83d2f..c0d417f45c7598cda6e0cec69a558988dd35f1f8 100644 (file)
@@ -94,7 +94,7 @@ budg(void)
     s_char buf[1024];
     s_char in[80];
 
-    bzero((s_char *)p_sect, sizeof(p_sect));
+    memset(p_sect, 0, sizeof(p_sect));
     etu = etu_per_update;
 
     np = getnatp(player->cnum);
index 9fb37fa5e84d8a327a8b1d3f8452d0f10c484589..de142330341b6a7d25cde4fe574f407c641cfdd7 100644 (file)
@@ -416,7 +416,7 @@ build_ship(register struct sctstr *sp, register struct mchrstr *mp,
     if (freeship == 0) {
        ef_extend(EF_SHIP, 50);
     }
-    bzero(&ship, sizeof(struct shpstr));
+    memset(&ship, 0, sizeof(struct shpstr));
     ship.shp_x = sp->sct_x;
     ship.shp_y = sp->sct_y;
     ship.shp_destx[0] = sp->sct_x;
@@ -572,7 +572,7 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
     if (freeland == 0) {
        ef_extend(EF_LAND, 50);
     }
-    bzero(&land, sizeof(struct lndstr));
+    memset(&land, 0, sizeof(struct lndstr));
     land.lnd_x = sp->sct_x;
     land.lnd_y = sp->sct_y;
     land.lnd_own = player->cnum;
@@ -598,7 +598,7 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
     land.lnd_fuel = lp->l_fuelc;
     land.lnd_nxlight = 0;
     land.lnd_rflags = 0;
-    bzero(land.lnd_rpath, 10);
+    memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
     land.lnd_rad_max = 0;
     land.lnd_nv = 0;
     land.lnd_att = (float)LND_ATTDEF(lp->l_att, tlev - lp->l_tech);
@@ -636,7 +636,7 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
     
     vec[I_FOOD] -= max_amt;
     
-    bzero(lvec, sizeof(lvec));
+    memset(lvec, 0, sizeof(lvec));
     getvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
     lvec[I_FOOD] += max_amt;
     putvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
@@ -937,7 +937,7 @@ build_plane(register struct sctstr *sp, register struct plchrstr *pp,
     if (freeplane == 0) {
        ef_extend(EF_PLANE, 50);
     }
-    bzero(&plane, sizeof(struct plnstr));
+    memset(&plane, 0, sizeof(struct plnstr));
     plane.pln_x = sp->sct_x;
     plane.pln_y = sp->sct_y;
     plane.pln_own = sp->sct_own;
index 5cfd5ba509476c84ce86159bbbeaa2518aa14974..a3f1dcb86fb3e108b2267d6f2059739024d807d8 100644 (file)
@@ -209,7 +209,7 @@ grab_sect(register struct sctstr *sp, natid to)
     int vec[I_MAX + 1];
 
     /* Wipe all the distribution info */
-    bzero((s_char *)vec, sizeof(vec));
+    memset(vec, 0, sizeof(vec));
     putvec(VT_DIST, vec, (s_char *)sp, EF_SECTOR);
     putvec(VT_DEL, vec, (s_char *)sp, EF_SECTOR);
     sp->sct_dist_x = sp->sct_x;
index 532b4fb5104fec50d3e0d8b46f01a8867f557901..3e99cf0aa6de818c150cafbf93a53aae31ba4046 100644 (file)
@@ -149,7 +149,7 @@ coll(void)
     makenotlost(EF_SECTOR, player->cnum, 0, sect.sct_x, sect.sct_y);
     sect.sct_own = player->cnum;
 
-    bzero((s_char *)vec, sizeof(vec));
+    memset(vec, 0, sizeof(vec));
     putvec(VT_DIST, vec, (s_char *)&sect, EF_SECTOR);
     putvec(VT_DEL, vec, (s_char *)&sect, EF_SECTOR);
     sect.sct_off = 1;
index b0b713e315d5eac6e5be0263b9366c0054c32631..4313a497613ef48a701efc3023fdb9d6d1e99ee6 100644 (file)
@@ -119,7 +119,7 @@ cons_choose(struct ltcomstr *ltcp)
     s_char prompt[128];
     s_char buf[1024];
 
-    bzero((s_char *)ltcp, sizeof(*ltcp));
+    memset(ltcp, 0, sizeof(*ltcp));
     if (getstarg(player->argp[1], "loan or treaty? ", buf) == 0)
        return RET_SYN;
     ltcp->type = ef_byname(buf);
index 42b88273fe7b2ca50b332fecc98ac0b4f689f1ef..3e095475c7d12f47656aa2236b94fe57fe53942d 100644 (file)
@@ -800,7 +800,7 @@ doship(s_char op, int arg, s_char *p, struct shpstr *ship)
        putvar(V_PTIME, arg, (s_char *)ship, EF_SHIP);
        break;
     case 'R':
-       bcopy(p, ship->shp_rpath, 10);
+       memcpy(ship->shp_rpath, p, sizeof(ship->shp_rpath));
        break;
     case 'W':
        ship->shp_rflags = arg;
@@ -1041,7 +1041,7 @@ dounit(s_char op, int arg, s_char *p, struct lndstr *land)
        land->lnd_retreat = arg;
        break;
     case 'R':
-       bcopy(p, land->lnd_rpath, 10);
+       memcpy(land->lnd_rpath, p, sizeof(land->lnd_rpath));
        break;
     case 'W':
        land->lnd_rflags = arg;
index ce469aaaf82861e94d671463072d20fbf8e38f3e..17d95f587976fc0564a4bee394ab67e85df04621 100644 (file)
@@ -53,7 +53,7 @@ int
 explore(void)
 {
     register int amount;
-    struct sctstr orig, sect;
+    struct sctstr sect;
     struct sctstr endsect;
     struct sctstr start;
     struct sctstr chksect;
@@ -91,7 +91,6 @@ explore(void)
        pr("Not yours\n");
        return RET_FAIL;
     }
-    bcopy((s_char *)&sect, (s_char *)&orig, sizeof(struct sctstr));
     infected = getvar(V_PSTAGE, (s_char *)&sect, EF_SECTOR) == PLG_INFECT;
     if ((amt_src = getvar(vtype, (s_char *)&sect, EF_SECTOR)) <= 0) {
        pr("No %s in %s\n", ip->i_name,
index 45d3baa3c31a4c14e1f9fd793fd1fc84c7915005..80876b8b5e550276e2558b56434ed8ec97ad6ec7 100644 (file)
@@ -76,7 +76,7 @@ flee(void)
        while ((r = nxtitem(&ni, (s_char *)&ship2))
               && (ship2.shp_fleet != c)) ;
        if (r) {
-           bcopy(ship2.shp_rpath, ship.shp_rpath, 10);
+           memcpy(ship.shp_rpath, ship2.shp_rpath, sizeof(ship.shp_rpath));
            ship.shp_rflags = ship2.shp_rflags;
        }
        putship(ship.shp_uid, &ship);
index bea9fd0cb41df40cf04a00c501d59aee84a2250b..a3976879bfdc2a92038cfad5a5c42f231f5d3644 100644 (file)
@@ -90,7 +90,7 @@ head(void)
     pr("::::::::::::::::::::::::::::::::::::::::::::::::::\n");
     pr("       %s", ctime(&now));
     pr("\n");
-    bzero((s_char *)hist, sizeof(hist));
+    memset(hist, 0, sizeof(hist));
     snxtitem_all(&nstr, EF_NEWS);
     maxcnum = 0;
     while (nxtitem(&nstr, (s_char *)&news)) {
index 28e08710d7f8cc090b5dfbdd5732c2c791db6ecc..b4e681896a5295c04686f37bad8c793ba67d67b6 100644 (file)
@@ -69,7 +69,7 @@ look(void)
        pr("Memory error.  Tell the deity.\n");
        return RET_FAIL;
     }
-    bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+    memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
     while (nxtitem(&ni, (s_char *)&myship)) {
        if (!player->owner)
            continue;
@@ -195,7 +195,7 @@ llook(void)
        pr("Memory error.  Tell the deity.\n");
        return RET_FAIL;
     }
-    bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+    memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
     while (nxtitem(&ni, (s_char *)&myland)) {
        if (!player->owner)
            continue;
index 8e10e6aa43d8483a05c81a57745cd49da23de11d..610542e9e32b7fb38dc1c4939de786546076c4e7 100644 (file)
@@ -694,7 +694,7 @@ defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
        if (nfiring > *nd)
            *nd = nfiring;
        fp = (struct flist *)malloc(sizeof(struct flist));
-       bzero((s_char *)fp, sizeof(struct flist));
+       memset(fp, 0, sizeof(struct flist));
        fp->defdam = dam;
        fp->victim = vict;
        switch (attacker) {
@@ -837,7 +837,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
 
            (*nfiring)++;
            fp = (struct flist *)malloc(sizeof(struct flist));
-           bzero((s_char *)fp, sizeof(struct flist));
+           memset(fp, 0, sizeof(struct flist));
            fp->type = targ_ship;
            fp->uid = ship.shp_uid;
            add_to_fired_queue(&fp->queue, list);
@@ -869,7 +869,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
                continue;
            (*nfiring)++;
            fp = (struct flist *)malloc(sizeof(struct flist));
-           bzero((s_char *)fp, sizeof(struct flist));
+           memset(fp, 0, sizeof(struct flist));
            fp->type = targ_ship;
            fp->uid = ship.shp_uid;
            add_to_fired_queue(&fp->queue, list);
@@ -922,7 +922,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
 
        (*nfiring)++;
        fp = (struct flist *)malloc(sizeof(struct flist));
-       bzero((s_char *)fp, sizeof(struct flist));
+       memset(fp, 0, sizeof(struct flist));
        fp->type = targ_unit;
        fp->uid = land.lnd_uid;
        add_to_fired_queue(&fp->queue, list);
@@ -973,7 +973,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
                continue;
            (*nfiring)++;
            fp = (struct flist *)malloc(sizeof(struct flist));
-           bzero((s_char *)fp, sizeof(struct flist));
+           memset(fp, 0, sizeof(struct flist));
            fp->x = firing.sct_x;
            fp->y = firing.sct_y;
            fp->type = targ_land;
index dadf00e1ce9a4972214b73e8bd3b3d928e0139cc..f60bb47da6bda3b2468140ffb0fde4dc302da4d7 100644 (file)
@@ -394,14 +394,11 @@ want_to_abandon(struct sctstr *sp, int vtype, int amnt, struct lndstr *lp)
 int
 would_abandon(struct sctstr *sp, int vtype, int amnt, struct lndstr *lp)
 {
-    struct sctstr sect;
     int mil, civs, loyalcivs;
 
     if ((vtype != V_CIVIL) && (vtype != V_MILIT))
        return 0;
 
-    bcopy((s_char *)sp, (s_char *)&sect, sizeof(struct sctstr));
-
     mil = getvar(V_MILIT, (s_char *)sp, EF_SECTOR);
     civs = getvar(V_CIVIL, (s_char *)sp, EF_SECTOR);
 
index 5025572b2e21f5a22b503c9be9fdd6ea7537278b..5468cba30676e70c9436dfe639948cf728cd90c0 100644 (file)
@@ -259,7 +259,7 @@ nav_map(int x, int y, int show_designations)
        logerror("malloc failed in navi\n");
        return RET_FAIL;
     }
-    bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+    memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
     /* zap any conditionals */
     ns.ncond = 0;
     xyrelrange(np, &ns.range, &range);
index c11ce30eaef691d445fcbb8a2de8fa1a011da5c5..4a6aa96ff2d96bc2eb8acced412a879704a7667f 100644 (file)
@@ -258,7 +258,7 @@ isok(int x, int y)
        pr("Memory error.  Tell the deity.\n");
        return 0;
     }
-    bzero((s_char *)map, (WORLD_X * WORLD_Y) / 2);
+    memset(map, 0, (WORLD_X * WORLD_Y) / 2);
     ok(map, x, y);
     free((s_char *)map);
     if (nfree < 5)
@@ -360,7 +360,7 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
     land.lnd_fuel = lp->l_fuelc;
     land.lnd_nxlight = 0;
     land.lnd_rflags = 0;
-    bzero((s_char *)land.lnd_rpath, 10);
+    memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
     land.lnd_rad_max = lp->l_rad;
     land.lnd_nv = 0;
 
@@ -381,7 +381,7 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
     land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, tlev - lp->l_tech);
     land.lnd_maxland = (int)LND_MXL(lp->l_mxland, tlev - lp->l_tech);
 
-    bzero((s_char *)lvec, sizeof(lvec));
+    memset(lvec, 0, sizeof(lvec));
     getvec(VT_ITEM, lvec, (s_char *)&land, EF_LAND);
     lvec[I_FOOD] +=
        vl_find(V_FOOD, lp->l_vtype, lp->l_vamt, (int)lp->l_nv);
index ddbf6a6bb7cb28a1fb0cdfb26f55b4af45f245cf..6ecfbb0be087afdcacadcd00df25f7b2b5295dd1 100644 (file)
@@ -67,8 +67,8 @@ news(void)
     s_char num[128];
     s_char *verb;
 
-    bzero((s_char *)page_has_news, sizeof(page_has_news));
-    bzero((s_char *)sectors_taken, sizeof(sectors_taken));
+    memset(page_has_news, 0, sizeof(page_has_news));
+    memset(sectors_taken, 0, sizeof(sectors_taken));
     (void)head();
     (void)time(&now);
     natp = getnatp(player->cnum);
index 963a2fe57459452f5137826e9f2f515c8a4abb56..dcbf364a8f749fb3310272b3f4360233fae09d16 100644 (file)
@@ -105,8 +105,9 @@ path(void)
     xyrelrange(natp, &absrange, &relrange);
     blankfill((s_char *)mapbuf, &ns.range, 3);
     while (*pp && (i = chkdir(*pp, DIR_STOP, DIR_LAST)) >= 0) {
-       bcopy(routech[i][0], &map[deltay(cy, ns.range.ly)]
-             [deltax(cx, ns.range.lx) * 2], 3);
+       memcpy(&map[deltay(cy, ns.range.ly)][deltax(cx, ns.range.lx) * 2],
+              routech[i][0],
+              3);
        cx += diroff[i][0];
        cy += diroff[i][1];
        ++pp;
index 800ce8c2fd88f188a8ac0ba321b05c0aa5bc2535..039cced9acd78082f6d122e4c347250504fffb38 100644 (file)
@@ -85,7 +85,7 @@ powe(void)
     int no_numbers = 0;
     s_char *p;
 
-    bzero((s_char *)targets, sizeof(targets));
+    memset(targets, 0, sizeof(targets));
     natp = getnatp(player->cnum);
     num = MAXNOC;
     if (player->argp[1] && player->argp[1][0] == 'n') {
@@ -247,7 +247,7 @@ gen_power(void)
     float f;
 
     player->btused += powe_cost;
-    bzero((s_char *)powbuf, sizeof(powbuf));
+    memset(powbuf, 0, sizeof(powbuf));
     snxtsct_all(&ns);
     while (nxtsct(&ns, &sect)) {
        if (sect.sct_own == 0)
index a6bb6de53d419d3fc27b7d2c00689b6d4a1d75c5..9d980b6b2f4fa7a28dbba8646de91031cb142906 100644 (file)
@@ -80,7 +80,7 @@ rea(void)
     int first = 1;
     int readit;
 
-    bzero(kind, 80);
+    memset(kind, 0, sizeof(kind));
     (void)time(&now);
 
     if (*player->argp[0] == 'w') {
index f03b68ceb34d3cbc9d756b6ef94c07dfd794a91e..cb62bc628d84eb935eec89c72eea19608a41d1c7 100644 (file)
@@ -76,7 +76,7 @@ repo(void)
        return RET_SYN;
     prdate();
     natp = getnatp(player->cnum);
-    bzero((s_char *)&mystat, sizeof(struct stats));
+    memset(&mystat, 0, sizeof(struct stats));
     mystat.stat = natp->nat_stat;
     if (mystat.stat & STAT_NORM) {
        mystat.res = natp->nat_level[NAT_RLEV];
index 0812141b5f907b77af060b3b14b3a9b7ae9588b5..ed1b3898dec24b2878406b4b77244648f50ebdb4 100644 (file)
@@ -144,11 +144,10 @@ retr(void)
            continue;
        }
        if (zero)
-           bzero(ship.shp_rpath, RET_LEN);
+           memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
 
        if (pq != (s_char *)0) {
-           bzero(ship.shp_rpath, RET_LEN);
-           bcopy(pq, ship.shp_rpath, strlen(pq));
+           strncpy(ship.shp_rpath, pq, sizeof(ship.shp_rpath));
            putship(ship.shp_uid, &ship);
        }
        if (rflags >= 0) {
@@ -273,11 +272,10 @@ lretr(void)
            continue;
        }
        if (zero)
-           bzero(land.lnd_rpath, RET_LEN);
+           memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
 
        if (pq != (s_char *)0) {
-           bzero(land.lnd_rpath, RET_LEN);
-           bcopy(pq, land.lnd_rpath, strlen(pq));
+           strncpy(land.lnd_rpath, pq, sizeof(land.lnd_rpath));
            putland(land.lnd_uid, &land);
        }
        if (rflags >= 0) {
index 27e60097151dd52e99fd514d9bcb399c61c0e682..22c3db7b7a1f6d00d41245071c458520f0f72dc4 100644 (file)
@@ -109,13 +109,12 @@ rout(void)
        return RET_FAIL;
     }
     ncond = ns.ncond;
-    bcopy((s_char *)ns.cond, (s_char *)cond,
-         sizeof(struct nscstr) * ncond);
+    memcpy(cond, ns.cond, sizeof(struct nscstr) * ncond);
     ns.ncond = 0;
 
     natp = getnatp(player->cnum);
     xyrelrange(natp, &ns.range, &relrange);
-    bzero((s_char *)mapbuf, ((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char)));
+    memset(mapbuf, 0, ((WORLD_Y * MAPWIDTH(3))));
     blankfill((s_char *)mapbuf, &ns.range, 3);
     border(&relrange, "     ", " ");
 
@@ -125,14 +124,14 @@ rout(void)
        p = &map[ns.dy][ns.dx * 2];
        if ((dir = getvar(i_del, (s_char *)&sect, EF_SECTOR) & 0x7) &&
            nstr_exec(cond, ncond, (s_char *)&sect, EF_SECTOR))
-           bcopy(routech[dir][0], p, 3);
+           memcpy(p, routech[dir][0], 3);
        p[1] = dchr[sect.sct_type].d_mnem;
     }
     for (row = 0, y = ns.range.ly; row < ns.range.height; y++, row++) {
        ry = yrel(natp, y);
-       bzero(buf, (MAPWIDTH(3) + 10) * sizeof(s_char));
+       memset(buf, 0, (MAPWIDTH(3) + 10));
        sprintf(buf, "%4d ", ry);
-       bcopy(map[row], buf + 5, ns.range.width * 2 + 1);
+       memcpy(buf + 5, map[row], ns.range.width * 2 + 1);
        sprintf(buf + 5 + ns.range.width * 2 + 1, " %-4d\n", ry);
        pr("%s", buf);
        if (y >= WORLD_Y)
index 19a9215ba8d65d7b939ab2ee127fc9c1015d7ad9..3109b5e78c3a9afba82a285e5b0b186b0b98aa09 100644 (file)
@@ -147,7 +147,6 @@ cmd_sail_ship(struct nstr_item *nstr)
        if (!check_ship_ok(&ship))
            continue;
        if (!player->aborted) {
-           bzero(ship.shp_path, sizeof(ship.shp_path));
            strncpy(ship.shp_path, cp, sizeof(ship.shp_path) - 2);
            ship.shp_mission = 0;
            putship(ship.shp_uid, &ship);
index 3f7ebdddf807e16a4efb3f471b0f3056a3b506d1..25c1ab5f4a6e1c1de52631b56618e0a84b49a628 100644 (file)
@@ -100,7 +100,7 @@ scra(void)
              || islist(p))) {
        s_char y_or_n[80], bbuf[80];
 
-       bzero(y_or_n, 80);
+       memset(y_or_n, 0, sizeof(y_or_n));
        if (type == EF_SHIP) {
            if (*p == '*')
                sprintf(bbuf, "all ships");
index 503d0f431cce2dad14b03a1e3ae7df9779347522..551fb3d9596ef729233a02611e2a8a38fa6117c5 100644 (file)
@@ -102,7 +102,7 @@ sct(void)
     }
     np = getnatp(player->cnum);
     ncond = ns.ncond;
-    bcopy((s_char *)ns.cond, (s_char *)cond, sizeof(*cond) * ncond);
+    memcpy(cond, ns.cond, sizeof(*cond) * ncond);
     ns.ncond = 0;
     xyrelrange(getnatp(player->cnum), &ns.range, &range);
     border(&range, "    ", "");
index 699f81873663eba8207705babaffeb78a4d43099..8120f3135d423098c334d3cc780d623d88bbf1b5 100644 (file)
@@ -158,7 +158,7 @@ sona(void)
                               rad[ns.dy][ns.dx], 0);
 
        }
-       bzero((s_char *)visbuf, (WORLD_Y * (WORLD_X + 1)));
+       memset(visbuf, 0, (WORLD_Y * (WORLD_X + 1)));
        snxtitem_dist(&nit, EF_SHIP, ship.shp_x, ship.shp_y, range);
        while (nxtitem(&nit, (caddr_t)&targ)) {
 
index 54e296880283f8c1820c32f8c1ec1203f6e0a033..5e94c34500af84c8d228c71174b34f4dd610e194 100644 (file)
@@ -105,7 +105,7 @@ spy(void)
      * 6 = neighbors, 2 = x,y
      */
     table = (coord *)malloc((nsects + 1) * 6 * 2 * sizeof(coord));
-    bzero((s_char *)table, (nsects + 1) * 6 * 2 * sizeof(coord));
+    memset(table, 0, (nsects + 1) * 6 * 2 * sizeof(coord));
     pr("SPY report\n");
     prdate();
     pr("                 old sct rd  rl  def\n");
index a6302deec44a464f52334afe30038162e3af29c6..c83bd8f41c54d666bfe7bff153b8773e38ce92e4 100644 (file)
@@ -111,8 +111,7 @@ surv(void)
        return RET_FAIL;
     }
     ncond = nstr.ncond;
-    bcopy((s_char *)nstr.cond, (s_char *)cond,
-         sizeof(struct nscstr) * ncond);
+    memcpy(cond, nstr.cond, sizeof(struct nscstr) * ncond);
     nstr.ncond = 0;
     np = getnatp(player->cnum);
     xyrelrange(np, &nstr.range, &range);
index 8e8b965858eaf5885229c1bb90b8aedb8bf54346..d6b50b26a85c86ed5a29446155a12b1f3afc345a 100644 (file)
@@ -139,7 +139,6 @@ torp(void)
            pr("Ship #%d has insufficient mobility\n", sub.shp_uid);
            continue;
        }
-       bzero(buf, 80);
        subno = sub.shp_uid;
        sprintf(prompt, "Ship %d, target? ", sub.shp_uid);
        if ((ptr = getstarg(player->argp[2], prompt, buf)) == 0)
index a5ebc2d50d6cb6b32a9d0c8efa865911dd048ea8..83af3a7d049b0d9960840d90357072d3ae7affa0 100644 (file)
@@ -51,7 +51,7 @@ wipe(void)
 
     if (!snxtsct(&nstr, player->argp[1]))
        return RET_SYN;
-    bzero((s_char *)vec, sizeof(vec));
+    memset(vec, 0, sizeof(vec));
     while (nxtsct(&nstr, &sect)) {
        if (!player->owner)
            continue;
index f8e3ad9bac109da5c10360906ab7b9443d29ac29..677a456bb6c734045068ac43b8c904fe73730926 100644 (file)
@@ -200,7 +200,7 @@ ef_read(int type, int id, caddr_t ptr)
            fillcache(ep, id);
        from = ep->cache + (id - ep->baseid) * ep->size;
     }
-    bcopy(from, ptr, ep->size);
+    memcpy(ptr, from, ep->size);
 
     if (ep->postread)
        ep->postread(id, ptr);
@@ -290,7 +290,7 @@ ef_write(int type, int id, caddr_t ptr)
     if (id >= ep->baseid && id < ep->baseid + ep->cids) {
        /* update the cache if necessary */
        to = ep->cache + (id - ep->baseid) * ep->size;
-       bcopy(ptr, to, ep->size);
+       memcpy(to, ptr, ep->size);
     }
     if (id > ep->fids) {
        logerror("WARNING ef_write: expanded %s by more than one id",
index 593189790e7e6533ee4104470b32598fb87ec8f5..9544a781e7c4a4e7d33c49b7fd4bf87c97a6acd2 100644 (file)
@@ -137,7 +137,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
                struct sctstr sect;
 
                if ((!player->god || country)) {
-                   bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+                   memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
                    bitinit2(nsp, bitmap, country);
                }
                while (nxtsct(nsp, &sect) && !player->aborted) {
@@ -177,7 +177,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
        int changed = 0;
 
        if ((!player->god || country)) {
-           bzero((s_char *)bitmap, (WORLD_X * WORLD_Y) / 8);
+           memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
            bitinit2(nsp, bitmap, country);
        }
        while (nxtsct(nsp, &sect) && !player->aborted) {
index c31fc7251220a0079f96e6c9e258bbbd594e46d8..3bba0d7ae8273f5c1710f32bedc8e03faf86ae51 100644 (file)
@@ -115,7 +115,7 @@ bp_init(void)
     ep = &empfile[EF_SECTOR];
 
     bp = (struct bestp *)malloc(sizeof(*bp));
-    bzero((s_char *)bp, sizeof(*bp));
+    memset(bp, 0, sizeof(*bp));
     bp->adp = as_init(BP_NEIGHBORS, BP_ASHASHSIZE, bp_coord_hash,
                      bp_neighbors, bp_lbcost, bp_realcost,
                      bp_seccost, (s_char *)bp);
index fbadfec2b3a2db6e9c47d5254507743698682b08..1aa8b165705708ccb5a2bde78fa01c232ab41f00 100644 (file)
@@ -42,7 +42,7 @@
 void
 snxtitem_area(register struct nstr_item *np, int type, struct range *range)
 {
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     np->cur = -1;
     np->type = type;
     np->sel = NS_AREA;
@@ -60,7 +60,7 @@ snxtitem_dist(register struct nstr_item *np, int type, int cx, int cy,
 {
     struct range range;
 
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     xydist_range(cx, cy, dist, &range);
     np->cur = -1;
     np->type = type;
@@ -83,7 +83,7 @@ snxtitem_dist(register struct nstr_item *np, int type, int cx, int cy,
 void
 snxtitem_xy(register struct nstr_item *np, int type, coord x, coord y)
 {
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     np->cur = -1;
     np->type = type;
     np->sel = NS_XY;
@@ -99,7 +99,7 @@ snxtitem_xy(register struct nstr_item *np, int type, coord x, coord y)
 void
 snxtitem_all(register struct nstr_item *np, int type)
 {
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     np->cur = -1;
     np->sel = NS_ALL;
     np->type = type;
@@ -115,7 +115,7 @@ snxtitem_group(register struct nstr_item *np, int type, s_char group)
 {
     if (group == '~')
        group = ' ';
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     np->cur = -1;
     np->sel = NS_GROUP;
     np->group = group;
@@ -140,7 +140,7 @@ snxtitem_list(register struct nstr_item *np, int type, int *list, int len)
 {
     int i;
 
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     np->cur = -1;
     np->type = type;
     np->sel = NS_LIST;
index 91025cadc16eb3391dc04b7ab7c0375c2edc9a63..853a9698b9aa7d44515f8e15a885a0681e7f157c 100644 (file)
@@ -60,7 +60,7 @@ snxtsct_all(struct nstr_sect *np)
 void
 snxtsct_area(register struct nstr_sect *np, struct range *range)
 {
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     np->range = *range;
     np->ncond = 0;
     np->type = NS_AREA;
@@ -87,7 +87,7 @@ snxtsct_rewind(struct nstr_sect *np)
 void
 snxtsct_dist(register struct nstr_sect *np, coord cx, coord cy, int dist)
 {
-    bzero((s_char *)np, sizeof(*np));
+    memset(np, 0, sizeof(*np));
     xydist_range(cx, cy, dist, &np->range);
     np->cx = cx;
     np->cy = cy;
index 38c1f1fffd6d0ecd3b0dd21a8a66d795c2b52a2c..ce95aa0c15e68da6858a83f5ca6ba70c731ebdd2 100644 (file)
 #include "gen.h"
 #include "optlist.h"
 
-#ifdef hpux
-#include <memory.h>
-
-void
-bzero(s_char *ptr, int len)
-{
-    memset(ptr, 0, len);
-}
-
-void
-bcopy(s_char *src, s_char *dst, int len)
-{
-    memcpy(dst, src, len);
-}
-#endif
-
 /*
  * space-fill a map or radar scan;
  * null terminate
index c9c20114a6d0b5fdec20920b614c118164c1b0bc..02d80ed18fa352994427c63d29712667418f4212 100644 (file)
@@ -212,7 +212,7 @@ ioqtobuf(struct ioqueue *ioq, s_char *buf, int cc)
        if (nbytes > 0) {
            if (nleft < nbytes)
                nbytes = nleft;
-           bcopy(io->data + io->offset, offset, nbytes);
+           memcpy(offset, io->data + io->offset, nbytes);
            offset += nbytes;
            nleft -= nbytes;
        }
@@ -312,7 +312,7 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
     if (avail > 0) {
        /* append to existing buffer */
        len = cc > avail ? avail : cc;
-       bcopy(buf, io->data + io->nbytes, len);
+       memcpy(io->data + io->nbytes, buf, len);
        io->nbytes += len;
        ioq->cc += len;
        if (avail < cc)
@@ -321,7 +321,7 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
        /* create a new buffer, minimum bufsize bytes */
        len = cc > ioq->bufsize ? cc : ioq->bufsize;
        ptr = malloc(len);
-       bcopy(buf, ptr, cc);
+       memcpy(ptr, buf, cc);
        io = (struct io *)malloc(sizeof(struct io));
        io->nbytes = cc;
        io->size = len;
@@ -414,7 +414,7 @@ ioq_makebuf(struct ioqueue *ioq, char *pBuf, int nBufLen)
        if (nbytes > nleft)
            break;
 
-       bcopy(io->data + io->offset, offset, nbytes);
+       memcpy(offset, io->data + io->offset, nbytes);
        offset += nbytes;
        nleft -= nbytes;
        ncopied += nbytes;
index b03774dd563943737dee68f5e97c78ba806fcb0d..c076c89bc2000910eebd03a57a24833759309650 100644 (file)
@@ -326,7 +326,7 @@ void *sp;
     static jmp_buf *cpp;
     extern struct lwpProc *LwpCurrent;
 
-    bzero(newp->context, sizeof(newp->context));
+    memset(newp->context, 0, sizeof(newp->context));
     newp->context[0] = (int)sp;
     /* preserve cpp for new context */
     cpp = (jmp_buf *) & newp->context;
index 8a996568a167f38aee67f76bd15994990f94ca42..0cc400e4c4c200b91d6a503447e832fe473b4a52 100644 (file)
@@ -194,10 +194,8 @@ char **argv;
        }
        lwpStatus(us, "selecting; sleep %ld secs", (long)delta);
 
-       bcopy((s_char *)&LwpSelect.readmask, (s_char *)&readmask,
-             sizeof(fd_set));
-       bcopy((s_char *)&LwpSelect.writemask, (s_char *)&writemask,
-             sizeof(fd_set));
+       memcpy(&readmask, &LwpSelect.readmask, sizeof(fd_set));
+       memcpy(&writemask, &LwpSelect.writemask, sizeof(fd_set));
        n = select(LwpSelect.maxfd + 1, &readmask, &writemask,
                   (fd_set *) 0, &tv);
 
index 29d6560c978ebc030091d93ef2b9d8e0453ef4e2..dbf2f98066802731dfca8b5654756b54db5aeec0 100644 (file)
@@ -77,8 +77,8 @@ player_new(int s, struct sockaddr_in *sin)
     struct player *lp;
     struct hostent *hostp;
 
-    lp = (struct player *)calloc(1, sizeof(struct player));
-    bzero((s_char *)lp, sizeof(struct player));
+    lp = (struct player *)malloc(sizeof(struct player));
+    memset(lp, 0, sizeof(struct player));
     if (sin) {
        /* update uses dummy player */
        /* so does the market updater */
index aab0ca21359313c67254938d3ca18723a22b485c..f7f2d3c452b5717c0b6bfcc294912f3aec67af29 100644 (file)
@@ -110,19 +110,18 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
    a sector, and then overfly some land units or ships, we don't want to
    potentially intercept 3 times. */
 
-    bzero((s_char *)&head, sizeof(struct shiplook));
+    memset(&head, 0, sizeof(struct shiplook));
     head.uid = -1;
 
     plp = (struct plist *)bomb_list->q_forw;
     plane_owner = plp->plane.pln_own;
 
-    bzero((s_char *)mypath, 1024);
-    bcopy(path, mypath, strlen(path));
+    strncpy(mypath, path, sizeof(mypath));
     myp = 0;
 
-    bzero((s_char *)overfly, sizeof(overfly));
-    bzero((s_char *)gotilist, sizeof(gotilist));
-    bzero((s_char *)unfriendly, sizeof(unfriendly));
+    memset(overfly, 0, sizeof(overfly));
+    memset(gotilist, 0, sizeof(gotilist));
+    memset(unfriendly, 0, sizeof(unfriendly));
     for (cn = 1; cn < MAXNOC; cn++) {
        if ((mynatp = getnatp(cn)) == 0)
            continue;
@@ -294,7 +293,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
 
     /* Something made it through */
     /* Go figure out if there are ships in this sector, and who's they are */
-    bzero((s_char *)nats, sizeof(nats));
+    memset(nats, 0, sizeof(nats));
     snxtitem_xy(&ni, EF_SHIP, x, y);
     while (nxtitem(&ni, (s_char *)&ship)) {
        if (mchr[(int)ship.shp_type].m_flags & M_SUB)
@@ -302,7 +301,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
        nats[ship.shp_own]++;
     }
     /* Go figure out if there are units in this sector, and who's they are */
-    bzero((s_char *)lnats, sizeof(lnats));
+    memset(lnats, 0, sizeof(lnats));
     snxtitem_xy(&ni, EF_LAND, x, y);
     while (nxtitem(&ni, (s_char *)&land)) {
        lnats[land.lnd_own]++;
@@ -736,7 +735,7 @@ ac_planedamage(struct plist *plp, natid from, int dam, natid other,
        strcpy(mesg, dmess);
        return;
     }
-    bzero(dmess, 255);
+    memset(dmess, 0, sizeof(dmess));
     eff -= dam;
     if (eff < 0)
        eff = 0;
@@ -850,7 +849,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
     plp = (struct plist *)list->q_forw;
     plane_owner = plp->plane.pln_own;
 
-    bzero((s_char *)nats, sizeof(nats));
+    memset(nats, 0, sizeof(nats));
     guns = 0;
     snxtitem_xy(&ni, EF_SHIP, x, y);
     while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&ship)) {
@@ -917,7 +916,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
     plp = (struct plist *)list->q_forw;
     plane_owner = plp->plane.pln_own;
 
-    bzero((s_char *)nats, sizeof(nats));
+    memset(nats, 0, sizeof(nats));
     guns = 0;
     snxtitem_xy(&ni, EF_LAND, x, y);
     while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&land)) {
@@ -1112,7 +1111,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
        ip->bombs = 0;
        ip->misc = 0;
        ip->pcp = &plchr[(int)plane.pln_type];
-       bcopy((s_char *)&plane, (s_char *)&ip->plane, sizeof(plane));
+       ip->plane = plane;
        emp_insque(&ip->queue, list);
     }
 }
index 797f0eb261d9530ebd4af7328581b3dfa9aeccca..a7dc836f7072e1e6612cbe306082e7b68e10c666 100644 (file)
@@ -106,7 +106,7 @@ set_have_looked(u_char uid, struct shiplook *head)
     }
 
     s = (struct shiplook *)malloc(sizeof(struct shiplook));
-    bzero((s_char *)s, sizeof(struct shiplook));
+    memset(s, 0, sizeof(struct shiplook));
     s2->next = s;
     s->uid = uid;
     s->looked = 1;
@@ -137,7 +137,7 @@ set_have_found(u_char uid, struct shiplook *head)
     }
 
     s = (struct shiplook *)malloc(sizeof(struct shiplook));
-    bzero((s_char *)s, sizeof(struct shiplook));
+    memset(s, 0, sizeof(struct shiplook));
     s2->next = s;
     s->uid = uid;
     s->found = 1;
index ac28aacd80cf2e79a6c7c631873a566d37be4204..f8bd64b9bbbb843155b821c8d1628bb381ad50d5 100644 (file)
@@ -115,7 +115,7 @@ static int get_land(int combat_mode, struct combat *def, int uid,
 int
 att_combat_init(struct combat *com, int type)
 {
-    bzero((s_char *)com, sizeof(*com));
+    memset(com, 0, sizeof(*com));
     com->type = type;
     return type;
 }
@@ -429,7 +429,7 @@ put_combat(struct combat *com)
        if (com->own == player->cnum) {
            land.lnd_mission = 0;
            land.lnd_rflags = 0;
-           bzero(land.lnd_rpath, RET_LEN);
+           memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
        }
        putland(com->lnd_uid, &land);
        break;
@@ -456,7 +456,7 @@ put_combat(struct combat *com)
        if (com->own == player->cnum) {
            ship.shp_mission = 0;
            ship.shp_rflags = 0;
-           bzero(ship.shp_rpath, RET_LEN);
+           memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
        }
        putship(com->shp_uid, &ship);
     }
@@ -832,7 +832,7 @@ att_ask_offense(int combat_mode, struct combat *off, struct combat *def,
     emp_initque(olist);
     if (att_abort(combat_mode, off, def))
        return 0;
-    bzero(land_answer, sizeof(land_answer));
+    memset(land_answer, 0, sizeof(land_answer));
     for (n = 0; n <= off->last; ++n) {
        off[n].troops = ask_off(combat_mode, off + n, def);
        if (att_abort(combat_mode, off, def))
@@ -1126,7 +1126,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
            abort_attack();
            return;
        }
-       bzero((s_char *)llp, sizeof(struct llist));
+       memset(llp, 0, sizeof(struct llist));
        emp_insque(&llp->queue, olist);
        llp->mobil = mobcost;
        if (!get_land(combat_mode, def, land.lnd_uid, llp, 0))
@@ -1292,7 +1292,7 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
            abort_attack();
            return 0;
        }
-       bzero((s_char *)llp, sizeof(struct llist));
+       memset(llp, 0, sizeof(struct llist));
        emp_insque(&llp->queue, list);
        llp->supplied = has_supply(&land);
        if (!get_land(A_DEFEND, def, land.lnd_uid, llp, 1))
@@ -1629,13 +1629,12 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
        llp = (struct llist *)
            malloc(sizeof(struct llist));
 
-       bzero((s_char *)llp, sizeof(struct llist));
+       memset(llp, 0, sizeof(struct llist));
        llp->supplied = supply_state;
        llp->x = origx;
        llp->y = origy;
        llp->lcp = &lchr[(int)land.lnd_type];
-       bcopy((s_char *)&land, (s_char *)&llp->land,
-             sizeof(struct lndstr));
+       llp->land = land;
        emp_insque(&llp->queue, list);
        if (lnd_spyval(&land) > *d_spyp)
            *d_spyp = lnd_spyval(&land);
@@ -2372,7 +2371,7 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
 
     if (QEMPTY(olist))
        return;
-    bzero(land_answer, sizeof(land_answer));
+    memset(land_answer, 0, sizeof(land_answer));
     for (qp = olist->q_forw; qp != olist; qp = next) {
        next = qp->q_forw;
        llp = (struct llist *)qp;
index 7c0dfc1b7a28ea34d0783ce4b9706d1163c9cf4d..642e77da247c08a0bf2048d6ffeec27e0d28192c 100644 (file)
@@ -55,7 +55,7 @@ lnd_postread(int n, s_char *ptr)
     if (llp->lnd_uid != n) {
        logerror("lnd_postread: Error - %d != %d, zeroing.\n",
                 llp->lnd_uid, n);
-       bzero(ptr, sizeof(struct lndstr));
+       memset(llp, 0, sizeof(struct lndstr));
     }
     if (llp->lnd_ship >= 0 && llp->lnd_own
        && llp->lnd_effic >= LAND_MINEFF) {
index 23fb4844dc95d30d2bbbf4226f75ba1a9b09dd49..a4362181ea69b50cb920a4728cd2b330c05f1e2d 100644 (file)
@@ -383,9 +383,9 @@ intelligence_report(int destination, struct lndstr *lp, int spy,
 
     lcp = &lchr[(int)lp->lnd_type];
 
-    bzero(buf1, 80);
-    bzero(buf2, 80);
-    bzero(buf3, 80);
+    memset(buf1, 0, sizeof(buf1));
+    memset(buf2, 0, sizeof(buf2));
+    memset(buf3, 0, sizeof(buf3));
     if (chance((double)(spy + lp->lnd_vis) / 10.0)) {
        if (destination == player->cnum)
            pr("%s %s", mess, prland(lp));
@@ -559,12 +559,11 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
        land.lnd_mission = 0;
        land.lnd_rflags = 0;
        land.lnd_harden = 0;
-       bzero(land.lnd_rpath, RET_LEN);
+       memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
        putland(land.lnd_uid, &land);
        llp = (struct llist *)malloc(sizeof(struct llist));
        llp->lcp = lcp;
-       bcopy((s_char *)&land, (s_char *)&llp->land,
-             sizeof(struct lndstr));
+       llp->land = land;
        llp->mobil = (double)land.lnd_mobil;
        emp_insque(&llp->queue, list);
     }
@@ -640,8 +639,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
            *minmobp = llp->mobil;
        if (llp->mobil > *maxmobp)
            *maxmobp = llp->mobil;
-       bcopy((s_char *)&land, (s_char *)&llp->land,
-             sizeof(struct lndstr));
+       llp->land = land;
     }
 }
 
index 8f080d46ac309c6e100ff7a0604e1961fdcfc911..f6873fa9415934fa6613ba05d03c4b06d8231aaf 100644 (file)
@@ -89,7 +89,7 @@ ground_interdict(coord x, coord y, natid victim, s_char *s)
     struct genlist mi[MAXNOC];
     int z;
 
-    bzero((s_char *)mi, sizeof(mi));
+    memset(mi, 0, sizeof(mi));
     for (z = 1; z < MAXNOC; z++)
        emp_initque((struct emp_qelem *)&mi[z]);
 
@@ -178,7 +178,7 @@ unit_interdict(coord x, coord y, natid victim, s_char *s, int hardtarget,
     int z;
     int osubs;
 
-    bzero((s_char *)mi, sizeof(mi));
+    memset(mi, 0, sizeof(mi));
     for (z = 1; z < MAXNOC; z++)
        emp_initque((struct emp_qelem *)&mi[z]);
 
@@ -230,7 +230,7 @@ off_support(coord x, coord y, natid victim, natid actee)
     struct genlist mi[MAXNOC];
     int z;
 
-    bzero((s_char *)mi, sizeof(mi));
+    memset(mi, 0, sizeof(mi));
     for (z = 1; z < MAXNOC; z++)
        emp_initque((struct emp_qelem *)&mi[z]);
 
@@ -251,7 +251,7 @@ def_support(coord x, coord y, natid victim, natid actee)
     struct genlist mi[MAXNOC];
     int z;
 
-    bzero((s_char *)mi, sizeof(mi));
+    memset(mi, 0, sizeof(mi));
     for (z = 1; z < MAXNOC; z++)
        emp_initque((struct emp_qelem *)&mi[z]);
 
@@ -385,7 +385,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
        }
 
        glp = (struct genlist *)malloc(sizeof(struct genlist));
-       bzero((s_char *)glp, sizeof(struct genlist));
+       memset(glp, 0, sizeof(struct genlist));
        glp->x = gp->x;
        glp->y = gp->y;
        glp->type = type;
@@ -401,7 +401,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
            break;
        }
        glp->thing = (s_char *)malloc(size);
-       bcopy(block, glp->thing, size);
+       memcpy(glp->thing, block, size);
        emp_insque(&glp->queue, &mi[gp->own].queue);
     }
 }
@@ -428,10 +428,9 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
            continue;
 
        plp = (struct plist *)malloc(sizeof(struct plist));
-       bzero((s_char *)plp, sizeof(struct plist));
+       memset(plp, 0, sizeof(struct plist));
        plp->pcp = &plchr[(int)plane.pln_type];
-       bcopy((s_char *)&plane, (s_char *)&plp->plane,
-             sizeof(struct plnstr));
+       plp->plane = plane;
        emp_insque(&plp->queue, escorts);
     }
 }
@@ -673,10 +672,9 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
            /* save planes for later */
            plp = (struct plist *)malloc(sizeof(struct plist));
 
-           bzero((s_char *)plp, sizeof(struct plist));
+           memset(plp, 0, sizeof(struct plist));
            plp->pcp = pcp;
-           bcopy(glp->thing, (s_char *)&plp->plane,
-                 sizeof(struct plnstr));
+           memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
            if (plp->pcp->pl_flags & P_M)
                emp_insque(&plp->queue, &missiles);
            else
@@ -1553,7 +1551,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
     for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw)
        count++;
 
-    bzero((s_char *)mi, sizeof(mi));
+    memset(mi, 0, sizeof(mi));
     for (z = 1; z < MAXNOC; z++)
        emp_initque((struct emp_qelem *)&mi[z]);
 
@@ -1582,10 +1580,9 @@ 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));
-           bzero((s_char *)plp, sizeof(struct plist));
+           memset(plp, 0, sizeof(struct plist));
            plp->pcp = (struct plchrstr *)glp->cp;
-           bcopy(glp->thing, (s_char *)&plp->plane,
-                 sizeof(struct plnstr));
+           memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
 
            /* missiles go one way, so we can use all the range */
            if (!(plp->pcp->pl_flags & P_M))
index 4204c082dcd4f9aa832eeee0050262b86546d891..e435d03b4945cb4d7a2f5e8b8db589b78357f4c2 100644 (file)
@@ -96,8 +96,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
        else {
            pr("Using best path '%s', movement cost %1.3f\n",
               path, total_mcost);
-           bzero(bpath, 512);
-           bcopy(path, bpath, strlen(path));
+           strncpy(bpath, path, sizeof(bpath));
            path = bpath;
        }
        if ((total_mcost * weight) > mobility) {
@@ -152,8 +151,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
                } else {
                    pr("Using best path '%s', movement cost %1.3f\n",
                       movstr, mv_cost);
-                   bzero(bpath, 512);
-                   bcopy(movstr, bpath, strlen(movstr));
+                   strncpy(bpath, movstr, sizeof(bpath));
                    movstr = bpath;
                }
            }
index 7b4589de9cfdf36d5396e7c82dddbb77cace2f9b..3db0927ac9e8b9fb4c33f857e1eadd9ec7fc5f3f 100644 (file)
@@ -57,9 +57,9 @@ msl_equip(struct plnstr *pp)
 {
     struct plist pl;
 
-    bzero((s_char *)&pl, sizeof(struct plist));
+    memset(&pl, 0, sizeof(struct plist));
     pl.pcp = plchr + pp->pln_type;
-    bcopy((s_char *)pp, (s_char *)&pl.plane, sizeof(struct plnstr));
+    pl.plane = *pp;
     return mission_pln_equip(&pl, 0, 0, 'p');
 }
 
@@ -210,7 +210,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
        irv->bombs = 0;
        irv->misc = 0;
        irv->pcp = &plchr[(int)plane.pln_type];
-       bcopy((s_char *)&plane, (s_char *)&irv->plane, sizeof(plane));
+       irv->plane = plane;
        emp_insque(&irv->queue, list);
     }
 }
index 827af3e78c42e306ea53ae3009490682d2149aeb..6f2e7c8150a650e7b94f5372d07be12ad2c0dd28 100644 (file)
@@ -53,7 +53,7 @@ nuk_postread(int n, s_char *ptr)
     if (np->nuk_uid != n) {
        logerror("nuk_postread: Error - %d != %d, zeroing.\n", np->nuk_uid,
                 n);
-       bzero(ptr, sizeof(struct nukstr));
+       memset(np, 0, sizeof(struct nukstr));
     }
     player->owner = (player->god || np->nuk_own == player->cnum);
     return 1;
@@ -119,7 +119,7 @@ nuk_add(coord x, coord y, int type, int num)
        nuk_uid = n;
     if (getnuke(nuk_uid, &nuke) == 0) {
        ef_extend(EF_NUKE, 10);
-       bzero((s_char *)&nuke, sizeof(struct nukstr));
+       memset(&nuke, 0, sizeof(struct nukstr));
        nuke.nuk_uid = nuk_uid;
        nuke.nuk_ship = -1;
        nuke.nuk_n = 0;
index 8f0eb1ff70ed1077ef2463f3dec032a69a7d398e..73c8923dfe76053bd50fe4a21e94c0c4c525a894 100644 (file)
@@ -55,7 +55,7 @@ pln_postread(int n, s_char *ptr)
     if (pp->pln_uid != n) {
        logerror("pln_postread: Error - %d != %d, zeroing.\n", pp->pln_uid,
                 n);
-       bzero(ptr, sizeof(struct plnstr));
+       memset(pp, 0, sizeof(struct plnstr));
     }
 
     if (pp->pln_ship >= 0 && pp->pln_own && pp->pln_effic >= PLANE_MINEFF) {
index d5fa20b7cc77aa7064787c09d764ca7f74e40367..ac3f6abe19a101f9c21e19b1494ad06293920a9a 100644 (file)
@@ -460,8 +460,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
        plp->misc = 0;
        plp->bombs = 0;
        plp->pcp = pcp;
-       bcopy((s_char *)&plane, (s_char *)&plp->plane,
-             sizeof(struct plnstr));
+       plp->plane = plane;
        emp_insque(&plp->queue, list);
     }
 }
index 913bba955590fbf9b1b963d61f11110bf56b9d07..bfad771a0580f75762a6a918343675f0280a061c 100644 (file)
@@ -112,7 +112,7 @@ radmap2(int owner,
        return;
     }
 
-    bzero((s_char *)visbuf, (WORLD_Y * (WORLD_X + 1)));
+    memset(visbuf, 0, (WORLD_Y * (WORLD_X + 1)));
     range = (int)(range * (eff / 100.0));
     if (range < 1)
        range = 1;
index b10511bea8c6d2a9d78b8ff51fb40cdb63ac193d..743c1406b31663ba005efca2232efdba92827bd9 100644 (file)
@@ -32,6 +32,7 @@
  *     
  */
 
+#include <string.h>
 #include "misc.h"
 #include "player.h"
 #include "nat.h"
@@ -100,8 +101,8 @@ retreat_ship(struct shpstr *sp, s_char code)
     s_char buf[2];
 
     if (sp->shp_rflags & RET_GROUP) {
-       bzero(buf, 2);
        buf[0] = sp->shp_fleet;
+       buf[1] = 0;
        snxtitem(&ni, EF_SHIP, buf);
        while (nxtitem(&ni, (s_char *)&ship))
            if ((ship.shp_fleet == buf[0]) &&
@@ -149,7 +150,6 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
     struct mchrstr *mcp;
     int vec[I_MAX + 1];
     int time_to_stop;
-    s_char buf[RET_LEN - 1];
 
     sp->shp_mission = 0;
     if (sp->shp_own == 0)
@@ -247,10 +247,7 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
            return 0;
        }
        dir = chkdir(sp->shp_rpath[0], DIR_STOP, DIR_VIEW);
-       bzero(buf, RET_LEN - 1);
-       bcopy(&sp->shp_rpath[1], buf, RET_LEN - 1);
-       bzero(sp->shp_rpath, RET_LEN);
-       bcopy(buf, sp->shp_rpath, RET_LEN - 1);
+       memmove(sp->shp_rpath, sp->shp_rpath+1, sizeof(sp->shp_rpath) - 1);
        if (dir == -1)
            continue;
        if (dir == DIR_STOP)
@@ -397,8 +394,8 @@ retreat_land(struct lndstr *lp, s_char code)
     s_char buf[2];
 
     if (lp->lnd_rflags & RET_GROUP) {
-       bzero(buf, 2);
        buf[0] = lp->lnd_army;
+       buf[1] = 0;
        snxtitem(&ni, EF_SHIP, buf);
        while (nxtitem(&ni, (s_char *)&land))
            if ((land.lnd_army == buf[0]) && (land.lnd_own == lp->lnd_own)) {
@@ -492,10 +489,7 @@ retreat_land1(struct lndstr *lp, s_char code, int orig)
            return 0;
        }
        dir = chkdir(lp->lnd_rpath[0], DIR_STOP, DIR_VIEW);
-       bzero(buf, RET_LEN - 1);
-       bcopy(&lp->lnd_rpath[1], buf, RET_LEN - 1);
-       bzero(lp->lnd_rpath, RET_LEN);
-       bcopy(buf, lp->lnd_rpath, RET_LEN - 1);
+       memmove(lp->lnd_rpath, lp->lnd_rpath+1, sizeof(lp->lnd_rpath) - 1);
        if (dir == -1)
            continue;
        if (dir == DIR_STOP)
index 8947418c5c90389950f6dd0ee4d6973536b437ac..95325bcd312b3a453a4d072ca234e3531ccbe961 100644 (file)
@@ -91,7 +91,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
     range = range * (eff / 100.0);
     pr("%s efficiency %d%%, max range %d\n", xyas(x, y, player->cnum),
        eff, range);
-    bzero(noise, sizeof(noise));
+    memset(noise, 0, sizeof(noise));
     if (eff < 100) {
        pr("Some noise on the transmission...\n");
        for (n = 0; n < (100 - eff); ++n)
index c087a75d35975208cbf05f8a9e7c158d6cc1e4c0..bbd77420edc130c1bd9b83e1de25e30ccf096792 100644 (file)
@@ -55,7 +55,7 @@ shp_postread(int n, s_char *ptr)
     if (sp->shp_uid != n) {
        logerror("shp_postread: Error - %d != %d, zeroing.\n", sp->shp_uid,
                 n);
-       bzero(ptr, sizeof(struct shpstr));
+       memset(sp, 0, sizeof(struct shpstr));
     }
 
     if (opt_MOB_ACCESS)
index 635696a7387793a0d2a17197b33a09e19ce623c8..da0e25aa3d210a0772da7da6ca3a87e8c096ebf1 100644 (file)
@@ -104,12 +104,11 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
 */
        ship.shp_mission = 0;
        ship.shp_rflags = 0;
-       bzero(ship.shp_rpath, RET_LEN);
+       memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
        putship(ship.shp_uid, &ship);
        mlp = (struct mlist *)malloc(sizeof(struct mlist));
        mlp->mcp = mcp;
-       bcopy((s_char *)&ship, (s_char *)&mlp->ship,
-             sizeof(struct shpstr));
+       mlp->ship = ship;
        mlp->mobil = (double)ship.shp_mobil;
        emp_insque(&mlp->queue, list);
     }
@@ -190,8 +189,7 @@ shp_nav(struct emp_qelem *list, double *minmobp, double *maxmobp,
            *minmobp = mlp->mobil;
        if (mlp->mobil > *maxmobp)
            *maxmobp = mlp->mobil;
-       bcopy((s_char *)&ship, (s_char *)&mlp->ship,
-             sizeof(struct shpstr));
+       mlp->ship = ship;
     }
 }
 
@@ -1051,7 +1049,7 @@ shp_missdef(struct shpstr *sp, natid victim)
 
     mlp = (struct mlist *)malloc(sizeof(struct mlist));
     mlp->mcp = &mchr[(int)sp->shp_type];
-    bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
+    mlp->ship = *sp;
     mlp->mobil = (double)sp->shp_mobil;
     emp_insque(&mlp->queue, &list);
     sprintf(buf, "%s", prship(&mlp->ship));
index f79abf4aeea9e45f271ac7f7e4415924535fcf2a..b438a6a95f607ceaff5373f390a3bd19f577e8c6 100644 (file)
@@ -398,7 +398,7 @@ s_commod(int own, int x, int y, int type, int total_wanted,
            int hold;
            struct lndstr l2;
 
-           bcopy((s_char *)&land, (s_char *)&l2, sizeof(struct lndstr));
+           l2 = land;
            hold = vec[type];
            vec[type] = 0;
            putvec(VT_ITEM, vec, (s_char *)&land, EF_LAND);
index 3a75716d338974424fc0a52bfe2c77e29e5abe4e..eb0f49982593f1dd9e31f167908df22096544b11 100644 (file)
@@ -69,7 +69,7 @@ takeover(register struct sctstr *sp, natid newown)
     extern int sect_mob_neg_factor;
 
     /* Wipe all the distribution info */
-    bzero((s_char *)vec, sizeof(vec));
+    memset(vec, 0, sizeof(vec));
     putvec(VT_DIST, vec, (s_char *)sp, EF_SECTOR);
     putvec(VT_DEL, vec, (s_char *)sp, EF_SECTOR);
     if (sp->sct_own == 0)
@@ -240,7 +240,7 @@ takeover_ship(register struct shpstr *sp, natid newown, int hostile)
     sp->shp_rflags = 0;
     /* Keep track of when this was taken over */
     time(&sp->shp_access);
-    bzero(sp->shp_rpath, RET_LEN);
+    memset(sp->shp_rpath, 0, sizeof(sp->shp_rpath));
     pp = &p;
     lp = &llp;
     /* Take over planes */
index 370272f948dc09105ec11ef1f53aac5703dc5dea..5e555bba3fd2581d6c8065e941c72cc48ee399df 100644 (file)
@@ -103,8 +103,7 @@ finish_sects(int etu)
     }
 
     /* Wipe it clean */
-    bzero((s_char *)g_distptrs, ((WORLD_X * WORLD_Y) *
-                                sizeof(struct distinfo)));
+    memset(g_distptrs, 0, ((WORLD_X * WORLD_Y) * sizeof(struct distinfo)));
 
     logerror("delivering...\n");
     /* Do deliveries */
@@ -233,7 +232,7 @@ assemble_dist_paths(struct distinfo *distptrs)
               cost */
            infptr->excost = pathcost(sp, p, MOB_ROAD);
 #ifdef SAVE_FINISH_PATHS
-           bcopy(p, infptr->path, len);
+           memcpy(infptr->path, p, len);
 #else
            infptr->path = finish_path;
 #endif /* SAVE_FINISH_PATHS */
index 6805a32df9456168fd81af7354c7d2e5ef59bef7..9db0d5cd9ae92deee69082d089cac576884edc68 100644 (file)
@@ -295,7 +295,7 @@ landrepair(register struct lndstr *land, int *vec, struct natstr *np,
 
     leftp = ((float)left / 100.0);
 
-    bzero((s_char *)mvec, sizeof(mvec));
+    memset(mvec, 0, sizeof(mvec));
     mvec[I_LCM] = lcm_needed = ldround((double)(lp->l_lcm * leftp), 1);
     mvec[I_HCM] = hcm_needed = ldround((double)(lp->l_hcm * leftp), 1);
 /*
@@ -324,7 +324,7 @@ landrepair(register struct lndstr *land, int *vec, struct natstr *np,
 
     build = ldround((double)(buildp * 100.0), 1);
 
-    bzero((s_char *)mvec, sizeof(mvec));
+    memset(mvec, 0, sizeof(mvec));
     mvec[I_LCM] = lcm_needed = roundavg((double)(lp->l_lcm * buildp));
     mvec[I_HCM] = hcm_needed = roundavg((double)(lp->l_hcm * buildp));
 /*
index e1354890b0120211843715025405bc83c0626547..b1aa0c1365c06f4a7512d2fff8a9d3a6fb73be0d 100644 (file)
@@ -95,10 +95,10 @@ update_main(void *argv)
      * happiness, and printing out the state of the nation)
      */
     logerror("production update (%d etus)", etu);
-    bzero((s_char *)pops, sizeof(pops));
-    bzero((s_char *)air_money, sizeof(air_money));
-    bzero((s_char *)sea_money, sizeof(sea_money));
-    bzero((s_char *)lnd_money, sizeof(lnd_money));
+    memset(pops, 0, sizeof(pops));
+    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));
     for (n = 0; n < MAXNOC; n++) {
        money[n] = 0;
@@ -116,7 +116,7 @@ update_main(void *argv)
        int y, z, sb = 0, sm = 0, pb = 0, pm = 0, lm = 0, lb = 0;
        long p_sect[SCT_MAXDEF + 1][2];
 
-       bzero((s_char *)p_sect, sizeof(p_sect));
+       memset(p_sect, 0, sizeof(p_sect));
        mil_dbl_pay = 0;
        if ((np = getnatp(x)) == (struct natstr *)0)
            continue;
index b40ad983099fc50fda92025fffe3a6a101ef955a..1b4f745fe733e89a05945bf409b82ba90fccd59f 100644 (file)
@@ -196,8 +196,8 @@ prod_nat(int etu)
     if (ally_factor > 0.0)
        share_incr(res, tech);
     else {
-       bzero((s_char *)res, sizeof(res));
-       bzero((s_char *)tech, sizeof(tech));
+       memset(res, 0, sizeof(res));
+       memset(tech, 0, sizeof(tech));
     }
     for (n = 0; NULL != (np = getnatp(n)); n++) {
        if ((np->nat_stat & STAT_NORM) == 0)
index 7b9aa1e036eb7b0673d0140318faa52f21ac0825..61622bee7ce467076c3e42df1659cdf98c55a738 100644 (file)
@@ -269,7 +269,7 @@ nav_ship(register struct shpstr *sp)
     emp_initque(&ship_list);
     mlp = (struct mlist *)malloc(sizeof(struct mlist));
     mlp->mcp = mchr + sp->shp_type;
-    bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
+    mlp->ship = *sp;
     mlp->mobil = (double)sp->shp_mobil;
     emp_insque(&mlp->queue, &ship_list);
 
index ac4637597f4ab5818bfd5aa7ff280d3da20514bc..1eafa6522f050644e34de99dea3740ec1c18f303 100644 (file)
@@ -63,7 +63,7 @@ do_plague(struct sctstr *sp, struct natstr *np, int etu)
     if (getvec(VT_ITEM, vec, (s_char *)sp, EF_SECTOR) <= 0)
        return;
     if (getvec(VT_COND, cvec, (s_char *)sp, EF_SECTOR) <= 0)
-       bzero((s_char *)cvec, sizeof(cvec));
+       memset(cvec, 0, sizeof(cvec));
 
     if (cvec[C_PSTAGE] == 0) {
        cvec[C_PSTAGE] = infect_people(np, vec, sp->sct_effic,
index dd0fcac489ea45f4231942693bd601b47ca225a8..b016d2c92a4a9ceb4aad65248be17fa2e1a2eecb 100644 (file)
@@ -203,7 +203,7 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
                left = delta;
 
            leftp = ((float)left / 100.0);
-           bzero((s_char *)mvec, sizeof(mvec));
+           memset(mvec, 0, sizeof(mvec));
            mvec[I_MILIT] = mil_needed =
                ldround((double)(plp->pl_crew * leftp), 1);
            mvec[I_LCM] = lcm_needed =
@@ -227,7 +227,7 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
                                      (float)plp->pl_hcm));
 
            build = ldround((double)(buildp * 100.0), 1);
-           bzero((s_char *)mvec, sizeof(mvec));
+           memset(mvec, 0, sizeof(mvec));
            mvec[I_MILIT] = mil_needed =
                roundavg((double)(plp->pl_crew * buildp));
            mvec[I_LCM] = lcm_needed =
index 677b83c0a32b437e3a9ec855a95ddb10c3eaa1a3..f8b05a3957cfee36a53b9497622f7e88e19adb42 100644 (file)
@@ -62,7 +62,7 @@ prepare_sects(int etu, int *bp)
     struct natstr *np;
     int n, civ_tax, uw_tax, mil_pay;
 
-    bzero((s_char *)levels, sizeof(levels));
+    memset(levels, 0, sizeof(levels));
 
 /* Process all the fallout. */
     if (opt_FALLOUT) {
index 8d642d6ede98eaf4a24470f213a674c588d403a4..0e6efe723059ddb825e841f66147be608d8c4374 100644 (file)
@@ -170,7 +170,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
 
     if (!fltp) {
        fltp = (struct fltheadstr *)malloc(sizeof(*fltp));
-       bzero((s_char *)fltp, sizeof(*fltp));
+       memset(fltp, 0, sizeof(*fltp));
 
        /* Fix the links. */
        fltp->next = (*head);
@@ -195,7 +195,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
     }
 
     this = (struct fltelemstr *)malloc(sizeof(*this));
-    bzero((s_char *)this, sizeof(*this));
+    memset(this, 0, sizeof(*this));
     this->num = sp->shp_uid;
     this->own = sp->shp_own;
     this->next = fltp->head;
@@ -345,7 +345,7 @@ fltp_to_list(struct fltheadstr *fltp, struct emp_qelem *list)
        mlp = (struct mlist *)malloc(sizeof(struct mlist));
        sp = getshipp(fe->num);
        mlp->mcp = mchr + sp->shp_type;
-       bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
+       mlp->ship = *sp;
        mlp->mobil = fe->mobil;
        emp_insque(&mlp->queue, list);
     }
index 04596212c32da0e3f5dccdb8c1b6d5176a97ee02..3a9f6de07ff6f9b38284dbd30371d6b3e9af3090 100644 (file)
@@ -376,7 +376,7 @@ shiprepair(register struct shpstr *ship, int *vec, struct natstr *np,
        left = delta;
 
     leftp = ((float)left / 100.0);
-    bzero((s_char *)mvec, sizeof(mvec));
+    memset(mvec, 0, sizeof(mvec));
     mvec[I_LCM] = lcm_needed = ldround((double)(mp->m_lcm * leftp), 1);
     mvec[I_HCM] = hcm_needed = ldround((double)(mp->m_hcm * leftp), 1);
 
@@ -390,7 +390,7 @@ shiprepair(register struct shpstr *ship, int *vec, struct natstr *np,
        buildp = MIN(buildp, ((float)mvec[I_HCM] / (float)mp->m_hcm));
 
     build = ldround((double)(buildp * 100.0), 1);
-    bzero((s_char *)mvec, sizeof(mvec));
+    memset(mvec, 0, sizeof(mvec));
     mvec[I_LCM] = lcm_needed = roundavg((double)(mp->m_lcm * buildp));
     mvec[I_HCM] = hcm_needed = roundavg((double)(mp->m_hcm * buildp));
 
index fc0fdf2ba51c6f1522a879ea1c9676b2bde6d32c..b80e19671d15aff34de6de304ca018352bb25a31 100644 (file)
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
            exit(1);
        }
     }
-    bzero((s_char *)&nat, sizeof(nat));
+    memset (&nat, 0, sizeof(nat));
     nat.ef_type = EF_NATION;
     if (nat.nat_cnam[0] == 0)
        strcpy(nat.nat_cnam, "POGO");
@@ -144,7 +144,7 @@ main(int argc, char *argv[])
        nat.nat_priorities[x] = -1;
     putnat((&nat));
     printf("All praise to %s!\n", nat.nat_cnam);
-    bzero((s_char *)&nat, sizeof(nat));
+    memset (&nat, 0, sizeof(nat));
     for (x = 0; x < SCT_MAXDEF + 8; x++)
        nat.nat_priorities[x] = -1;
     for (i = 1; i < MAXNOC; i++) {
@@ -175,7 +175,7 @@ main(int argc, char *argv[])
     chmod(teldir, 0770);
 
     /* create a zero-filled sector file */
-    bzero((s_char *)&sct, sizeof(sct));
+    memset(&sct, 0, sizeof(sct));
     for (y = 0; y < WORLD_Y; y++) {
        for (x = 0; x < WORLD_X / 2; x++) {
            file_sct_init(x * 2 + (y & 01), y, (s_char *)&sct);
index 0342286f5a6b985d0f27098547039b433f2649c5..7a6d895b3e97551ed20d4e95e1ae2e3bcac16c7e 100644 (file)
@@ -366,7 +366,7 @@ s_char *restype;
 
        x2 = x1;
        y2 = y1;
-       bzero((s_char *)tried, sizeof(tried));
+       memset(tried, 0, sizeof(tried));
        numtried = 0;
        while ((sects[y2 * XPLATES + x2 / 2].sct_type == SCT_WATER) ||
               (*