caddr_t is obsolete. Replace by void *, except for struct empfile

member cache, which becomes char * to keep pointer arithmetic simple.
This commit is contained in:
Markus Armbruster 2004-08-23 18:29:44 +00:00
parent 059353e957
commit dcfd251f95
40 changed files with 80 additions and 82 deletions

View file

@ -213,7 +213,7 @@ grab_sect(register struct sctstr *sp, natid to)
pp = &p;
snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
while (nxtitem(&ni, (caddr_t)pp)) {
while (nxtitem(&ni, pp)) {
if (pp->pln_own == 0)
continue;
if (pp->pln_ship >= 0)
@ -236,7 +236,7 @@ grab_sect(register struct sctstr *sp, natid to)
np = &nuk;
snxtitem_xy(&ni, EF_NUKE, sp->sct_x, sp->sct_y);
while (nxtitem(&ni, (caddr_t)np)) {
while (nxtitem(&ni, np)) {
if (np->nuk_own == 0)
continue;
@ -251,7 +251,7 @@ grab_sect(register struct sctstr *sp, natid to)
lp = &l;
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (nxtitem(&ni, (caddr_t)lp)) {
while (nxtitem(&ni, lp)) {
if (lp->lnd_own == 0)
continue;
if (lp->lnd_ship == 0)
@ -342,7 +342,7 @@ grab_ship(register struct shpstr *sp, natid to)
pp = &p;
snxtitem_xy(&ni, EF_PLANE, sp->shp_x, sp->shp_y);
while (nxtitem(&ni, (caddr_t)pp)) {
while (nxtitem(&ni, pp)) {
if (pp->pln_own == 0)
continue;
if (pp->pln_flags & PLN_LAUNCHED)
@ -365,7 +365,7 @@ grab_ship(register struct shpstr *sp, natid to)
lp = &l;
snxtitem_xy(&ni, EF_LAND, sp->shp_x, sp->shp_y);
while (nxtitem(&ni, (caddr_t)lp)) {
while (nxtitem(&ni, lp)) {
if (lp->lnd_own == 0)
continue;
if (lp->lnd_ship != sp->shp_uid)

View file

@ -144,7 +144,7 @@ cons_choose(struct ltcomstr *ltcp)
sprintf(prompt, "%s number? ", ltcp->Name);
if ((ltcp->num = onearg(player->argp[2], prompt)) < 0)
return RET_SYN;
if (!ef_read(ltcp->type, ltcp->num, (caddr_t)&ltcp->u) ||
if (!ef_read(ltcp->type, ltcp->num, &ltcp->u) ||
!(ltcp->type == EF_TREATY
? distrea(ltcp->num, &ltcp->u.t)
: disloan(ltcp->num, &ltcp->u.l))) {
@ -204,7 +204,7 @@ loan_accept(struct ltcomstr *ltcp)
pr("%s %d is still pending.\n", ltcp->Name, ltcp->num);
return RET_OK;
}
if (!getloan(ltcp->num, (caddr_t)lp)) {
if (!getloan(ltcp->num, lp)) {
pr("loan_accept: can't read loan; get help!\n");
return RET_SYS;
}

View file

@ -64,7 +64,7 @@ fina(void)
prdate();
pr("Loan From To Rate Dur Paid Total\n");
snxtitem(&ni, EF_LOAN, "*");
while (nxtitem(&ni, (caddr_t)&loan)) {
while (nxtitem(&ni, &loan)) {
if (loan.l_status != LS_SIGNED)
continue;
pr(" %-2d (%3d) %-8.8s (%3d) %-8.8s ", ni.cur,

View file

@ -205,7 +205,7 @@ launch_as(struct plnstr *pp)
}
goodtarget = 0;
snxtitem_dist(&ni, EF_PLANE, sx, sy, 0);
while (!goodtarget && nxtitem(&ni, (caddr_t)&plane)) {
while (!goodtarget && nxtitem(&ni, &plane)) {
if (!plane.pln_own)
continue;
if (!(plane.pln_flags & PLN_LAUNCHED))

View file

@ -786,7 +786,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
return 0;
dam = 0;
snxtitem_dist(&ni, EF_SHIP, ax, ay, 8);
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
if (ship.shp_own == 0)
continue;
@ -874,7 +874,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
}
}
snxtitem_dist(&ni, EF_LAND, ax, ay, 8);
while (nxtitem(&ni, (caddr_t)&land)) {
while (nxtitem(&ni, &land)) {
if (land.lnd_own == 0)
continue;
if (land.lnd_effic < LAND_MINFIREEFF)

View file

@ -159,7 +159,7 @@ sona(void)
}
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)) {
while (nxtitem(&nit, &targ)) {
if (targ.shp_own == player->cnum || targ.shp_own == 0)
continue;

View file

@ -207,7 +207,7 @@ expose_ship(struct shpstr *s1, struct shpstr *s2)
*/
int
tend_nxtitem(struct nstr_item *np, caddr_t ptr)
tend_nxtitem(struct nstr_item *np, void *ptr)
{
struct genitem *gp;
int selected;

View file

@ -111,7 +111,7 @@ tran_nuke(void)
snxtitem_xy(&nstr, EF_NUKE, sect.sct_x, sect.sct_y);
#endif
found = 0;
while (nxtitem(&nstr, (caddr_t)&nuke)) {
while (nxtitem(&nstr, &nuke)) {
if (player->owner) {
found = 1;
break;

View file

@ -171,10 +171,10 @@ ef_ptr(int type, int id)
* This system won't work if item size is > sizeof buffer area.
*/
int
ef_read(int type, int id, caddr_t ptr)
ef_read(int type, int id, void *ptr)
{
register struct empfile *ep;
caddr_t from;
void *from;
if (ef_check(type) < 0)
return 0;
@ -219,7 +219,7 @@ fillcache(struct empfile *ep, int start)
* zaps read cache
*/
int
ef_nbread(int type, int id, caddr_t ptr)
ef_nbread(int type, int id, void *ptr)
{
register struct empfile *ep;
int r;
@ -256,7 +256,7 @@ ef_nbread(int type, int id, caddr_t ptr)
* and writes through to disk.
*/
int
ef_write(int type, int id, caddr_t ptr)
ef_write(int type, int id, void *ptr)
{
register int r;
register struct empfile *ep;
@ -310,7 +310,7 @@ ef_write(int type, int id, caddr_t ptr)
* zaps read cache
*/
int
ef_nbwrite(int type, int id, caddr_t ptr)
ef_nbwrite(int type, int id, void *ptr)
{
register struct empfile *ep;
register int r;

View file

@ -178,7 +178,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
return RET_OK;
if (map_flags & MAP_PLANE) {
snxtitem_all(&ni, EF_PLANE);
while (nxtitem(&ni, (caddr_t)&plane)) {
while (nxtitem(&ni, &plane)) {
if (plane.pln_own == 0)
continue;
if (plane.pln_own != player->cnum && !player->god)
@ -193,7 +193,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
}
if (map_flags & MAP_SHIP) {
snxtitem_all(&ni, EF_SHIP);
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
if (ship.shp_own == 0)
continue;
if (ship.shp_own != player->cnum && !player->god)
@ -208,7 +208,7 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
}
if (map_flags & MAP_LAND) {
snxtitem_all(&ni, EF_LAND);
while (nxtitem(&ni, (caddr_t)&land)) {
while (nxtitem(&ni, &land)) {
if (land.lnd_own == 0)
continue;
if (land.lnd_own != player->cnum && !player->god)

View file

@ -146,7 +146,7 @@ detonate(struct plnstr *pp, int x, int y)
}
}
snxtitem_dist(&ni, EF_PLANE, x, y, rad);
while (nxtitem(&ni, (caddr_t)&plane)) {
while (nxtitem(&ni, &plane)) {
/* Nukes falling on water affect only 1 sector */
if ((plane.pln_x != x) && issea)
continue;
@ -197,7 +197,7 @@ detonate(struct plnstr *pp, int x, int y)
putplane(ni.cur, &plane);
}
snxtitem_dist(&ni, EF_LAND, x, y, rad);
while (nxtitem(&ni, (caddr_t)&land)) {
while (nxtitem(&ni, &land)) {
/* Nukes falling on water affect only 1 sector */
if ((land.lnd_x != x) && issea)
continue;
@ -244,7 +244,7 @@ detonate(struct plnstr *pp, int x, int y)
putland(land.lnd_uid, &land);
}
snxtitem_dist(&ni, EF_SHIP, x, y, rad);
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
/* Nukes falling on water affect only 1 sector */
if ((ship.shp_x != x) && issea)
continue;
@ -285,7 +285,7 @@ detonate(struct plnstr *pp, int x, int y)
putship(ship.shp_uid, &ship);
}
snxtitem_dist(&ni, EF_NUKE, x, y, rad);
while (nxtitem(&ni, (caddr_t)&nuke)) {
while (nxtitem(&ni, &nuke)) {
/* Nukes falling on water affect only 1 sector */
if ((nuke.nuk_x != x) && issea)
continue;

View file

@ -82,7 +82,7 @@ sd(natid att, natid own, coord x, coord y, int noisy, int defending,
return 0;
eff = 1.0;
snxtitem_dist(&ni, EF_SHIP, x, y, 8);
while (nxtitem(&ni, (caddr_t)&ship) && eff > 0.30) {
while (nxtitem(&ni, &ship) && eff > 0.30) {
if (ship.shp_own == att)
continue;
if (ship.shp_own == 0)

View file

@ -46,7 +46,7 @@
#include "prototypes.h"
int
nxtitem(struct nstr_item *np, caddr_t ptr)
nxtitem(struct nstr_item *np, void *ptr)
{
struct genitem *gp;
int selected;

View file

@ -70,7 +70,7 @@ nxtsct(register struct nstr_sect *np, struct sctstr *sp)
continue;
}
np->id = sctoff(np->x, np->y);
if (!np->read(EF_SECTOR, np->id, (caddr_t)sp))
if (!np->read(EF_SECTOR, np->id, sp))
continue;
if (np->ncond == 0)
return 1;

View file

@ -136,7 +136,7 @@ radmap2(int owner,
if (!pr_flag)
return;
snxtitem_dist(&ni, EF_PLANE, cx, cy, range);
while (nxtitem(&ni, (caddr_t)&plane)) {
while (nxtitem(&ni, &plane)) {
if (plane.pln_own == 0)
continue;
/* Used to have 'ghosts' when scanning whole world --ts */
@ -149,7 +149,7 @@ radmap2(int owner,
}
}
snxtitem_dist(&ni, EF_SHIP, cx, cy, range);
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
if (ship.shp_own == 0)
continue;
/* Used to have 'ghosts' when scanning whole world --ts */

View file

@ -159,7 +159,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
pr(" own shp# ship type sector eff\n");
}
}
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
if (ship.shp_own == 0)
continue;
if ((mchr[(int)ship.shp_type].m_flags & M_SUB) &&
@ -214,7 +214,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
prdate();
pr(" own lnd# unit type sector eff\n");
}
while (nxtitem(&ni, (caddr_t)&land)) {
while (nxtitem(&ni, &land)) {
if (land.lnd_own == 0)
continue;
if (!chance((double)land.lnd_effic / 20.0))
@ -308,7 +308,7 @@ satdisp(struct sctstr *sp, int acc, int showstuff)
return;
snxtitem_xy(&ni, EF_SHIP, sp->sct_x, sp->sct_y);
first = 1;
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
if (ship.shp_own == 0)
continue;
if (mchr[(int)ship.shp_type].m_flags & M_SUB)
@ -335,7 +335,7 @@ satdisp(struct sctstr *sp, int acc, int showstuff)
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
first = 1;
while (nxtitem(&ni, (caddr_t)&land)) {
while (nxtitem(&ni, &land)) {
if (land.lnd_own == 0)
continue;
if (!chance((double)land.lnd_effic / 20.0))

View file

@ -932,7 +932,7 @@ shp_missile_defense(coord dx, coord dy, natid bombown, int hardtarget)
snxtitem_dist(&ni, EF_SHIP, dx, dy, 1);
while (nxtitem(&ni, (caddr_t)&ship)) {
while (nxtitem(&ni, &ship)) {
if (!ship.shp_own)
continue;

View file

@ -71,7 +71,7 @@ takeover(register struct sctstr *sp, natid newown)
pp = &p;
/* Take over planes */
snxtitem_dist(&ni, EF_PLANE, sp->sct_x, sp->sct_y, 0);
while (nxtitem(&ni, (caddr_t)pp)) {
while (nxtitem(&ni, pp)) {
if (pp->pln_own != sp->sct_own)
continue;
takeover_plane(pp, newown);
@ -80,7 +80,7 @@ takeover(register struct sctstr *sp, natid newown)
/* Take over land units */
lp = &land;
snxtitem_dist(&ni, EF_LAND, sp->sct_x, sp->sct_y, 0);
while (nxtitem(&ni, (caddr_t)lp)) {
while (nxtitem(&ni, lp)) {
if ((lp->lnd_own == newown) || (lp->lnd_own == 0))
continue;
if (lp->lnd_own != sp->sct_own)
@ -232,7 +232,7 @@ takeover_ship(register struct shpstr *sp, natid newown, int hostile)
lp = &llp;
/* Take over planes */
snxtitem_all(&ni, EF_PLANE);
while (nxtitem(&ni, (caddr_t)pp)) {
while (nxtitem(&ni, pp)) {
if (pp->pln_ship != sp->shp_uid)
continue;
if (pp->pln_own == 0)
@ -255,7 +255,7 @@ takeover_ship(register struct shpstr *sp, natid newown, int hostile)
}
/* Take over land units */
snxtitem_all(&ni, EF_LAND);
while (nxtitem(&ni, (caddr_t)lp)) {
while (nxtitem(&ni, lp)) {
if (lp->lnd_ship != sp->shp_uid)
continue;
if (lp->lnd_own == 0)
@ -295,7 +295,7 @@ takeover_land(register struct lndstr *landp, natid newown, int hostile)
lp = &llp;
/* Take over planes */
snxtitem_all(&ni, EF_PLANE);
while (nxtitem(&ni, (caddr_t)pp)) {
while (nxtitem(&ni, pp)) {
if (pp->pln_land != landp->lnd_uid)
continue;
if (pp->pln_own == 0)
@ -318,7 +318,7 @@ takeover_land(register struct lndstr *landp, natid newown, int hostile)
}
/* Take over land units */
snxtitem_all(&ni, EF_LAND);
while (nxtitem(&ni, (caddr_t)lp)) {
while (nxtitem(&ni, lp)) {
if (lp->lnd_land != landp->lnd_uid)
continue;
if (lp->lnd_own == 0)

View file

@ -144,7 +144,7 @@ typed_wu(natid from, natid to, s_char *message, int type)
tel.tel_length = len;
tel.tel_type = type;
#if !defined(_WIN32)
iov[0].iov_base = (caddr_t)&tel;
iov[0].iov_base = &tel;
iov[0].iov_len = sizeof(tel);
iov[1].iov_base = message;
iov[1].iov_len = len;

View file

@ -2,7 +2,7 @@
# indent needs to know type names do to a proper job.
# Type names located with grep typedef, then extracted by hand:
types="caddr_t coord empth_sem_t empth_t loc_Sem_t loc_Thread_t natid ns_seltype nsc_cat nsc_flags nsc_type packed_nsc_cat packed_nsc_type qsort_func_t s_char stkalign_t u_char u_int u_short"
types="coord empth_sem_t empth_t loc_Sem_t loc_Thread_t natid ns_seltype nsc_cat nsc_flags nsc_type packed_nsc_cat packed_nsc_type qsort_func_t s_char stkalign_t u_char u_int u_short"
opts="-kr -cdw -cp8 -ncs -psl -ss"
for t in $types