Clean up dead stores

Does not change optimized code (gcc -O).

Spotted by the Clang Static Analyzer.
This commit is contained in:
Markus Armbruster 2010-01-16 17:40:28 +01:00
parent 3650587dab
commit b8f5eaff0b
25 changed files with 66 additions and 116 deletions

View file

@ -420,7 +420,6 @@ ac_airtoair(struct emp_qelem *att_list, struct emp_qelem *int_list)
struct plist *interceptor;
struct emp_qelem *att;
struct emp_qelem *in;
int nplanes;
int more_att;
int more_int;
struct emp_qelem *att_next;
@ -439,9 +438,6 @@ ac_airtoair(struct emp_qelem *att_list, struct emp_qelem *int_list)
att_next = att->q_forw;
attacker = (struct plist *)att;
interceptor = (struct plist *)in;
nplanes = attacker->plane.pln_effic;
if (nplanes > interceptor->plane.pln_effic)
nplanes = interceptor->plane.pln_effic;
ac_dog(attacker, interceptor);
in = in_next;
att = att_next;
@ -751,8 +747,6 @@ ac_fireflak(struct emp_qelem *list, natid from, int guns)
struct emp_qelem *next;
char msg[255];
plp = (struct plist *)list->q_forw;
for (qp = list->q_forw; qp != list; qp = next) {
next = qp->q_forw;
plp = (struct plist *)qp;

View file

@ -99,7 +99,6 @@ print_shiplist(struct shiplist *head)
{
struct shiplist *s;
int first;
struct mchrstr *mp;
struct shpstr ship;
s = head;
@ -107,7 +106,6 @@ print_shiplist(struct shiplist *head)
while (s != NULL) {
getship(s->uid, &ship);
mp = &mchr[(int)ship.shp_type];
if (first) {
pr(" # player->owner eff type\n");
first = 0;

View file

@ -54,7 +54,7 @@ blankfill(char *ptr, struct range *range, int size)
p = ptr;
while (--col >= 0)
*p++ = ' ';
*p++ = 0;
*p = 0;
ptr += MAPWIDTH(size);
}
}

View file

@ -178,10 +178,9 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
taken = llp->unit.land.lnd_item[I_MILIT];
/* Spies always die */
if (((struct lchrstr *)llp->chrp)->l_flags & L_SPY) {
eff_eq = 100;
if (((struct lchrstr *)llp->chrp)->l_flags & L_SPY)
llp->unit.land.lnd_effic = 0;
} else {
else {
eff_eq = ldround(cas * 100.0 /
((struct lchrstr *)llp->chrp)->l_item[I_MILIT], 1);
llp->unit.land.lnd_effic -= eff_eq;
@ -1054,7 +1053,6 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
/* move survivors to done */
for (qp = cur.q_back; qp != &cur; qp = next) {
next = qp->q_back;
llp = (struct ulist *)qp;
emp_remque(qp);
emp_insque(qp, &done);
}

View file

@ -175,7 +175,6 @@ draw_map(int bmap, char origin, int map_flags, struct nstr_sect *nsp)
switch (bmap) {
default:
CANT_REACH();
bmap = 'b';
/* fall through */
case 'b':
while (bmnxtsct(nsp) && !player->aborted) {

View file

@ -1075,7 +1075,6 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
if (!plp->load)
continue;
newdam = 0;
if (plp->pcp->pl_flags & P_A) {
if (roll(100) > pln_identchance(pp, hardtarget, EF_SHIP)) {
wu(0, pp->pln_own,

View file

@ -216,7 +216,6 @@ msl_intercept(struct plnstr *msl, struct sctstr *sp, int sublaunch,
int news_item)
{
struct plnstr *pp;
struct plchrstr *pcp;
struct emp_qelem *intlist;
struct emp_qelem intfoo;
struct emp_qelem *qp;
@ -236,7 +235,6 @@ msl_intercept(struct plnstr *msl, struct sctstr *sp, int sublaunch,
pp = &ip->plane;
if (pp->pln_own != sp->sct_own)
continue;
pcp = ip->pcp;
if (mission_pln_equip(ip, NULL, 'i') < 0) {
emp_remque(qp);
free(qp);
@ -255,7 +253,6 @@ msl_intercept(struct plnstr *msl, struct sctstr *sp, int sublaunch,
next = qp->q_forw;
ip = (struct plist *)qp;
pp = &ip->plane;
pcp = ip->pcp;
if (mission_pln_equip(ip, NULL, 'i') < 0) {
emp_remque(qp);
free(qp);
@ -287,7 +284,6 @@ msl_intercept(struct plnstr *msl, struct sctstr *sp, int sublaunch,
qp = intlist->q_forw;
ip = (struct plist *)qp;
pp = &ip->plane;
pcp = ip->pcp;
mpr(msl->pln_own, "%s %s launched in defense!\n",
cname(pp->pln_own), def_name);

View file

@ -145,7 +145,6 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
if (sp->shp_own == 0)
return 0;
n = 0;
if (sp->shp_effic < SHIP_MINEFF) {
wu(0, sp->shp_own,
"%s %s,\nbut it died in the attack, and so couldn't retreat!\n",
@ -405,7 +404,6 @@ retreat_land1(struct lndstr *lp, char code, int orig)
if (lp->lnd_own == 0)
return 0;
n = 0;
if (lp->lnd_effic < LAND_MINEFF) {
wu(0, lp->lnd_own,
"%s %s,\nbut it died in the attack, and so couldn't retreat!\n",

View file

@ -130,7 +130,6 @@ takeover(struct sctstr *sp, natid newown)
* n: random number from -25:75 + (50 - loyalty)
*/
n = (50 - sp->sct_loyal) + ((random() % 100) - 25);
che_count = 0;
if (n > 0 && sp->sct_own == sp->sct_oldown) {
che_count = (civ * n / 3000) + 5;
if (che_count * 2 > civ)