From: jwalz Date: Sun, 10 Mar 2002 00:30:53 +0000 (+0000) Subject: Lint part 1, unused variables, routines, and return codes. X-Git-Tag: MOVE2GIT~3016 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bab78d03c8db242acecf88c587dee5b25a1eae94;p=nethack Lint part 1, unused variables, routines, and return codes. --- diff --git a/include/decl.h b/include/decl.h index 52ea184c4..717a23fdd 100644 --- a/include/decl.h +++ b/include/decl.h @@ -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; diff --git a/include/extern.h b/include/extern.h index c1873100c..faea64d93 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 ### */ diff --git a/src/apply.c b/src/apply.c index 82ef6428a..780f8c9b2 100644 --- a/src/apply.c +++ b/src/apply.c @@ -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; diff --git a/src/decl.c b/src/decl.c index 222bd908d..a82e493b7 100644 --- a/src/decl.c +++ b/src/decl.c @@ -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; diff --git a/src/do.c b/src/do.c index 730969b67..2b7bbe9a7 100644 --- a/src/do.c +++ b/src/do.c @@ -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)); } diff --git a/src/engrave.c b/src/engrave.c index cc1014eda..108abe89b 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -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 diff --git a/src/hack.c b/src/hack.c index e1e1109e7..79ff8ec4c 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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 */ diff --git a/src/mcastu.c b/src/mcastu.c index 8019b0d46..794bdd24e 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -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: { diff --git a/src/mon.c b/src/mon.c index e40b07005..5d01a590b 100644 --- a/src/mon.c +++ b/src/mon.c @@ -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)); diff --git a/src/options.c b/src/options.c index c33f64a0f..f74cdaef0 100644 --- a/src/options.c +++ b/src/options.c @@ -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[] diff --git a/src/pickup.c b/src/pickup.c index 2b45fd123..19a8bf5ea 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -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) { diff --git a/src/polyself.c b/src/polyself.c index f47e1f060..019c846c6 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -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); } diff --git a/src/read.c b/src/read.c index 3c9e39e82..32516e25e 100644 --- a/src/read.c +++ b/src/read.c @@ -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, diff --git a/src/teleport.c b/src/teleport.c index bf6703e53..91dc36812 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -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(); diff --git a/src/trap.c b/src/trap.c index ab5ddeca2..82d07456f 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2316,6 +2316,7 @@ xchar x, y; switch (obj->otyp) { case ICE_BOX: continue; /* Immune */ + /*NOTREACHED*/ break; case CHEST: chance = 40; diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index c13af4d6c..77a2df053 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -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); diff --git a/sys/share/pcunix.c b/sys/share/pcunix.c index 84e2d425e..0064e3390 100644 --- a/sys/share/pcunix.c +++ b/sys/share/pcunix.c @@ -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 is that this include file - * does not exist on all systems, and moreover, that it sometimes includes - * 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) diff --git a/sys/unix/unixres.c b/sys/unix/unixres.c index c2fa39fad..390cc85d3 100644 --- a/sys/unix/unixres.c +++ b/sys/unix/unixres.c @@ -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 */