Lint part 1, unused variables, routines, and return codes.

This commit is contained in:
jwalz
2002-03-10 00:30:53 +00:00
parent 570a6e8bbd
commit bab78d03c8
18 changed files with 43 additions and 90 deletions

View File

@@ -27,7 +27,9 @@ E char SAVEP[];
E NEARDATA int bases[MAXOCLASSES];
E NEARDATA int multi;
#if 0
E NEARDATA int warnlevel;
#endif
E NEARDATA int nroom;
E NEARDATA int nsubroom;
E NEARDATA int occtime;

View File

@@ -1406,7 +1406,6 @@ E void FDECL(msleep, (unsigned));
/* ### pcunix.c ### */
#if defined(MICRO)
E void FDECL(gethdate, (char *));
E void FDECL(regularize, (char *));
#endif /* MICRO */
#if defined(PC_LOCKING)
@@ -2012,7 +2011,6 @@ E void VDECL(error, (const char *,...)) PRINTF_F(1,2);
/* ### unixunix.c ### */
#ifdef UNIX
E void FDECL(gethdate, (const char *));
E void NDECL(getlock);
E void FDECL(regularize, (char *));
# ifdef SHELL
@@ -2026,7 +2024,9 @@ E int FDECL(child, (int));
/* ### unixres.c ### */
#ifdef UNIX
# ifdef GNOME_GRAPHICS
E int FDECL(hide_privileges, (BOOLEAN_P));
# endif
#endif /* UNIX */
/* ### vault.c ### */

View File

@@ -1860,6 +1860,7 @@ struct obj *otmp;
case WAX:
color = "waxy";
goto see_streaks; /* okay even if not touchstone */
/*NOTREACHED*/
break;
case CLOTH:
pline_The("stone looks a little more polished now.");
@@ -1867,6 +1868,7 @@ struct obj *otmp;
case WOOD:
color = "wooden";
goto see_streaks; /* okay even if not touchstone */
/*NOTREACHED*/
break;
}
return;

View File

@@ -20,7 +20,9 @@ char *catmore = 0; /* default pager */
NEARDATA int bases[MAXOCLASSES] = DUMMY;
NEARDATA int multi = 0;
#if 0
NEARDATA int warnlevel = 0; /* used by movemon and dochugw */
#endif
NEARDATA int nroom = 0;
NEARDATA int nsubroom = 0;
NEARDATA int occtime = 0;

View File

@@ -469,7 +469,7 @@ register struct obj *obj;
char buf[BUFSZ];
/* doname can call s_suffix, reusing its buffer */
strcpy(buf, s_suffix(mon_nam(u.ustuck)));
Strcpy(buf, s_suffix(mon_nam(u.ustuck)));
You("drop %s into %s %s.", doname(obj), buf,
mbodypart(u.ustuck, STOMACH));
}

View File

@@ -336,7 +336,7 @@ register int x,y;
char *et;
unsigned maxelen = BUFSZ - sizeof("You feel the words: \"\". ");
if (strlen(ep->engr_txt) > maxelen) {
strncpy(buf, ep->engr_txt, maxelen);
(void) strncpy(buf, ep->engr_txt, maxelen);
buf[maxelen] = '\0';
et = buf;
} else

View File

@@ -550,7 +550,7 @@ boolean test_only;
uwep && is_pick(uwep)) {
/* MRKR: Automatic digging when wielding the appropriate tool */
if (!test_only)
use_pick_axe2(uwep);
(void) use_pick_axe2(uwep);
return FALSE;
} else {
if ( !test_only ) {
@@ -668,9 +668,9 @@ static void findtravelpath()
xchar travelstepy[2][COLNO*ROWNO];
int n=1;
int set=0;
int d=1;
int dia=1;
memset(travel,0,sizeof(travel));
(void) memset(travel,0,sizeof(travel));
travelstepx[0][0] = u.tx;
travelstepy[0][0] = u.ty;
@@ -699,7 +699,7 @@ static void findtravelpath()
if ( !travel[nx][ny] ) {
travelstepx[1-set][nn]=nx;
travelstepy[1-set][nn]=ny;
travel[nx][ny]=d;
travel[nx][ny]=dia;
nn++;
}
}
@@ -708,7 +708,7 @@ static void findtravelpath()
}
n = nn;
set = 1-set;
d++;
dia++;
}
/* give up */

View File

@@ -507,7 +507,7 @@ int spellnum;
destroy_item(SCROLL_CLASS, AD_FIRE);
destroy_item(POTION_CLASS, AD_FIRE);
destroy_item(SPBOOK_CLASS, AD_FIRE);
burn_floor_paper(u.ux, u.uy, TRUE, FALSE);
(void) burn_floor_paper(u.ux, u.uy, TRUE, FALSE);
break;
case CLC_LIGHTNING:
{

View File

@@ -383,7 +383,8 @@ register struct monst *mtmp;
pline("%s burns slightly.", Monnam(mtmp));
}
if (mtmp->mhp > 0) {
fire_damage(mtmp->minvent, FALSE, FALSE, mtmp->mx, mtmp->my);
(void) fire_damage(mtmp->minvent, FALSE, FALSE,
mtmp->mx, mtmp->my);
rloc(mtmp);
return 0;
}
@@ -1395,16 +1396,16 @@ register struct monst *mtmp;
/* TRUE if corpse might be dropped, magr may die if mon was swallowed */
boolean
corpse_chance(mon, magr, swallowed)
corpse_chance(mon, magr, was_swallowed)
struct monst *mon;
struct monst *magr; /* killer, if swallowed */
boolean swallowed; /* digestion */
boolean was_swallowed; /* digestion */
{
struct permonst *mdat = mon->data;
int i, tmp;
if (mdat == &mons[PM_VLAD_THE_IMPALER] || mdat->mlet == S_LICH) {
if (cansee(mon->mx, mon->my) && !swallowed)
if (cansee(mon->mx, mon->my) && !was_swallowed)
pline("%s body crumbles into dust.", s_suffix(Monnam(mon)));
return FALSE;
}
@@ -1419,7 +1420,7 @@ boolean swallowed; /* digestion */
tmp = d((int)mdat->mlevel+1, (int)mdat->mattk[i].damd);
else tmp = 0;
if (Half_physical_damage) tmp = (tmp+1) / 2;
if (swallowed && magr) {
if (was_swallowed && magr) {
if (magr == &youmonst) {
There("is an explosion in your %s!",
body_part(STOMACH));

View File

@@ -2373,7 +2373,6 @@ boolean setinitial,setfromfile;
retval = TRUE;
} else if (!strcmp("disclose", optname)) {
int pick_cnt, pick_idx, opt_idx;
winid tmpwin;
menu_item *disclosure_category_pick = (menu_item *)0;
/*
* The order of disclose_names[]

View File

@@ -2133,9 +2133,7 @@ boolean put_in;
menu_item *pick_list;
int mflags, res;
long count;
boolean all_blessed, all_cursed, all_uncursed, all_buc_unknown;
all_blessed = all_cursed = all_uncursed = all_buc_unknown = FALSE;
if (retry) {
all_categories = (retry == -2);
} else if (flags.menu_style == MENU_FULL) {

View File

@@ -960,11 +960,11 @@ dogaze()
dmg = 0;
}
if((int) u.ulevel > rn2(20))
destroy_mitem(mtmp, SCROLL_CLASS, AD_FIRE);
(void) destroy_mitem(mtmp, SCROLL_CLASS, AD_FIRE);
if((int) u.ulevel > rn2(20))
destroy_mitem(mtmp, POTION_CLASS, AD_FIRE);
(void) destroy_mitem(mtmp, POTION_CLASS, AD_FIRE);
if((int) u.ulevel > rn2(25))
destroy_mitem(mtmp, SPBOOK_CLASS, AD_FIRE);
(void) destroy_mitem(mtmp, SPBOOK_CLASS, AD_FIRE);
if (dmg && !DEADMONSTER(mtmp)) mtmp->mhp -= dmg;
if (mtmp->mhp <= 0) killed(mtmp);
}

View File

@@ -91,7 +91,7 @@ doread()
u.uconduct.literate++;
if(flags.verbose)
pline("It reads:");
strcpy(buf, shirt_msgs[scroll->o_id % SIZE(shirt_msgs)]);
Strcpy(buf, shirt_msgs[scroll->o_id % SIZE(shirt_msgs)]);
erosion = greatest_erosion(scroll);
if (erosion)
wipeout_text(buf,

View File

@@ -248,7 +248,8 @@ register int nux,nuy;
/* this should only drag the chain (and never give a near-
capacity message) since we already checked ball distance */
drag_ball(u.ux, u.uy, &bc_control, &ballx, &bally, &chainx, &chainy, &cause_delay);
(void) drag_ball(u.ux, u.uy, &bc_control, &ballx, &bally,
&chainx, &chainy, &cause_delay);
move_bc(0, bc_control, ballx, bally, chainx, chainy);
} else
placebc();

View File

@@ -2316,6 +2316,7 @@ xchar x, y;
switch (obj->otyp) {
case ICE_BOX:
continue; /* Immune */
/*NOTREACHED*/
break;
case CHEST:
chance = 40;

View File

@@ -231,8 +231,7 @@ char *argv[];
u.ux = 0; /* prevent flush_screen() */
/* chdir shouldn't be called before this point to keep the
* code parallel to other ports which call gethdate just
* before here.
* code parallel to other ports.
*/
#ifdef CHDIR
chdirx(hackdir,1);

View File

@@ -33,62 +33,6 @@ static struct stat hbuf;
static int NDECL(eraseoldlocks);
#endif
void
gethdate(name)
char *name;
{
# ifdef WANT_GETHDATE
#if 0
/* old version - for people short of space */
register char *np;
if(stat(name, &hbuf))
error("Cannot get status of %s.",
(np = rindex(name, '/')) ? np+1 : name);
#endif
/* version using PATH from: seismo!gregc@ucsf-cgl.ARPA (Greg Couch) */
/*
* The problem with #include <sys/param.h> is that this include file
* does not exist on all systems, and moreover, that it sometimes includes
* <sys/types.h> again, so that the compiler sees these typedefs twice.
*/
#define MAXPATHLEN 1024
register char *np, *path;
char filename[MAXPATHLEN+1], *getenv();
int pathlen;
if (index(name, '/') != (char *)0 || (path = getenv("PATH")) == (char *)0)
path = "";
for (;;) {
if ((np = index(path, ':')) == (char *)0)
np = path + strlen(path); /* point to end str */
pathlen = np - path;
if (pathlen > MAXPATHLEN)
pathlen = MAXPATHLEN;
if (pathlen <= 1) { /* %% */
(void) strncpy(filename, name, MAXPATHLEN);
} else {
(void) strncpy(filename, path, pathlen);
filename[pathlen] = '/';
(void) strncpy(filename + pathlen + 1, name,
(MAXPATHLEN - 1) - pathlen);
}
filename[MAXPATHLEN] = '\0';
if (stat(filename, &hbuf) == 0)
return;
if (*np == '\0')
path = "";
path = np + 1;
}
if (strlen(name) > BUFSZ/2)
name = name + strlen(name) - BUFSZ/2;
error("Cannot get status of %s.", (np = rindex(name, '/')) ? np+1 : name);
# endif /* WANT_GETHDATE */
}
#if 0
int
uptodate(fd)

View File

@@ -18,7 +18,7 @@
#ifdef GETRES_SUPPORT
#if defined(LINUX)
# if defined(LINUX)
static _syscall3(int, getresuid, unsigned short *, ruid, \
unsigned short *, euid, unsigned short *, suid)
@@ -55,9 +55,10 @@ gid_t *rgid, *egid, *sgid;
return retval;
}
#elif defined(BSD) || defined(SVR4)
# else
# if defined(BSD) || defined(SVR4)
#ifdef SYS_getresuid
# ifdef SYS_getresuid
static int
real_getresuid(ruid, euid, suid)
@@ -66,7 +67,7 @@ uid_t *ruid, *euid, *suid;
return syscall(SYS_getresuid, ruid, euid, suid);
}
#else /* SYS_getresuid */
# else /* SYS_getresuid */
static int
real_getresuid(ruid, euid, suid)
@@ -88,9 +89,9 @@ uid_t *ruid, *euid, *suid;
return retval;
}
#endif /* SYS_getresuid */
# endif /* SYS_getresuid */
#ifdef SYS_getresgid
# ifdef SYS_getresgid
static int
real_getresgid(rgid, egid, sgid)
@@ -99,7 +100,7 @@ gid_t *rgid, *egid, *sgid;
return syscall(SYS_getresgid, rgid, egid, sgid);
}
#else /* SYS_getresgid */
# else /* SYS_getresgid */
static int
real_getresgid(rgid, egid, sgid)
@@ -121,8 +122,9 @@ gid_t *rgid, *egid, *sgid;
return retval;
}
#endif /* SYS_getresgid */
#endif /* LINUX || BSD || SVR4 */
# endif /* SYS_getresgid */
# endif /* BSD || SVR4 */
# endif /* LINUX */
static unsigned int hiding_privileges = 0;
@@ -199,11 +201,13 @@ nh_getegid()
#else /* GETRES_SUPPORT */
# ifdef GNOME_GRAPHICS
int
hide_privileges(flag)
boolean flag;
{
return 0;
}
# endif
#endif /* GETRES_SUPPORT */