shadowed declaration warning

<Someone> complained that his compiler was giving these
warnings:
cmd.c:2119: warning: declaration of `expl' shadows a global declaration
dungeon.c:292: warning: declaration of `rand' shadows a global declaration
exper.c💯 warning: declaration of `exp' shadows a global declaration
files.c:278: warning: declaration of `basename' shadows a global declaration
hack.c:1102: warning: declaration of `expl' shadows a global declaration
pickup.c:2081: warning: declaration of `select' shadows a global declaration
role.c:1060: warning: declaration of `conj' shadows a global declaration
This commit is contained in:
nethack.allison
2004-12-16 00:20:54 +00:00
parent 9bc23ab484
commit 28a1a41668
8 changed files with 38 additions and 38 deletions

View File

@@ -2202,7 +2202,7 @@ const char *msg;
char ctrl;
winid win;
static const char wiz_only_list[] = "EFGIOVW";
char buf[BUFSZ], buf2[BUFSZ], *expl;
char buf[BUFSZ], buf2[BUFSZ], *explain;
win = create_nhwindow(NHW_TEXT);
if (!win) return FALSE;
@@ -2214,7 +2214,7 @@ const char *msg;
if (letter(sym)) {
sym = highc(sym);
ctrl = (sym - 'A') + 1;
if ((expl = dowhatdoes_core(ctrl, buf2))
if ((explain = dowhatdoes_core(ctrl, buf2))
&& (!index(wiz_only_list, sym)
#ifdef WIZARD
|| wizard
@@ -2225,7 +2225,7 @@ const char *msg;
" as specified in the Guidebook");
putstr(win, 0, buf);
putstr(win, 0, "");
putstr(win, 0, expl);
putstr(win, 0, explain);
putstr(win, 0, "");
putstr(win, 0, "To use that command, you press");
Sprintf(buf,

View File

@@ -279,15 +279,15 @@ struct proto_dungeon *pd;
* or dungeon entrance can occupy.
*
* Note: This follows the acouple (instead of the rcouple) rules for a
* negative random component (rand < 0). These rules are found
* negative random component (randc < 0). These rules are found
* in dgn_comp.y. The acouple [absolute couple] section says that
* a negative random component means from the (adjusted) base to the
* end of the dungeon.
*/
STATIC_OVL int
level_range(dgn, base, rand, chain, pd, adjusted_base)
level_range(dgn, base, randc, chain, pd, adjusted_base)
xchar dgn;
int base, rand, chain;
int base, randc, chain;
struct proto_dungeon *pd;
int *adjusted_base;
{
@@ -308,11 +308,11 @@ level_range(dgn, base, rand, chain, pd, adjusted_base)
*adjusted_base = base;
if (rand == -1) { /* from base to end of dungeon */
if (randc == -1) { /* from base to end of dungeon */
return (lmax - base + 1);
} else if (rand) {
} else if (randc) {
/* make sure we don't run off the end of the dungeon */
return (((base + rand - 1) > lmax) ? lmax-base+1 : rand);
return (((base + randc - 1) > lmax) ? lmax-base+1 : randc);
} /* else only one choice */
return 1;
}

View File

@@ -97,20 +97,20 @@ experience(mtmp, nk) /* return # of exp points for mtmp after nk killed */
}
void
more_experienced(exp, rexp)
register int exp, rexp;
more_experienced(exper, rexp)
register int exper, rexp;
{
long newexp = u.uexp + exp;
long rexpincr = 4*exp + rexp;
long newexp = u.uexp + exper;
long rexpincr = 4*exper + rexp;
long newrexp = u.urexp + rexpincr;
/* cap experience and score on wraparound */
if (newexp < 0 && exp > 0) newexp = LONG_MAX;
if (newexp < 0 && exper > 0) newexp = LONG_MAX;
if (newrexp < 0 && rexpincr > 0) newrexp = LONG_MAX;
u.uexp = newexp;
u.urexp = newrexp;
if(exp
if(exper
#ifdef SCORE_ON_BOTL
|| flags.showscore
#endif

View File

@@ -5,7 +5,7 @@
#include "hack.h"
/* Note: Arrays are column first, while the screen is row first */
static int expl[3][3] = {
static int explosion[3][3] = {
{ S_explode1, S_explode4, S_explode7 },
{ S_explode2, S_explode5, S_explode8 },
{ S_explode3, S_explode6, S_explode9 }
@@ -189,7 +189,7 @@ int expltype;
for (i=0; i<3; i++) for (j=0; j<3; j++) {
if (explmask[i][j] == 2) continue;
tmp_at(starting ? DISP_BEAM : DISP_CHANGE,
explosion_to_glyph(expltype,expl[i][j]));
explosion_to_glyph(expltype,explosion[i][j]));
tmp_at(i+x-1, j+y-1);
starting = 0;
}
@@ -215,7 +215,7 @@ int expltype;
for (i=0; i<3; i++) for (j=0; j<3; j++) {
if (explmask[i][j] == 1)
show_glyph(i+x-1,j+y-1,
explosion_to_glyph(expltype, expl[i][j]));
explosion_to_glyph(expltype, explosion[i][j]));
}
} else { /* delay a little bit. */

View File

@@ -280,30 +280,30 @@ int bufsz;
/*ARGSUSED*/
#endif
const char *
fqname(basename, whichprefix, buffnum)
const char *basename;
fqname(basenam, whichprefix, buffnum)
const char *basenam;
int whichprefix, buffnum;
{
#ifndef PREFIXES_IN_USE
return basename;
return basenam;
#else
if (!basename || whichprefix < 0 || whichprefix >= PREFIX_COUNT)
return basename;
if (!basenam || whichprefix < 0 || whichprefix >= PREFIX_COUNT)
return basenam;
if (!fqn_prefix[whichprefix])
return basename;
return basenam;
if (buffnum < 0 || buffnum >= FQN_NUMBUF) {
impossible("Invalid fqn_filename_buffer specified: %d",
buffnum);
buffnum = 0;
}
if (strlen(fqn_prefix[whichprefix]) + strlen(basename) >=
if (strlen(fqn_prefix[whichprefix]) + strlen(basenam) >=
FQN_MAX_FILENAME) {
impossible("fqname too long: %s + %s", fqn_prefix[whichprefix],
basename);
return basename; /* XXX */
basenam);
return basenam; /* XXX */
}
Strcpy(fqn_filename_buffer[buffnum], fqn_prefix[whichprefix]);
return strcat(fqn_filename_buffer[buffnum], basename);
return strcat(fqn_filename_buffer[buffnum], basenam);
#endif
}

View File

@@ -1132,17 +1132,17 @@ domove()
if (context.forcefight ||
/* remembered an 'I' && didn't use a move command */
(glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
boolean expl = (Upolyd && attacktype(youmonst.data, AT_EXPL));
boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL));
char buf[BUFSZ];
Sprintf(buf,"a vacant spot on the %s", surface(x,y));
You("%s %s.",
expl ? "explode at" : "attack",
explo ? "explode at" : "attack",
!Underwater ? "thin air" :
is_pool(x,y) ? "empty water" : buf);
unmap_object(x, y); /* known empty -- remove 'I' if present */
newsym(x, y);
nomul(0);
if (expl) {
if (explo) {
u.mh = -1; /* dead in the current form */
rehumanize();
}

View File

@@ -2077,7 +2077,7 @@ register int held;
#endif
boolean one_by_one, allflag, quantum_cat = FALSE,
loot_out = FALSE, loot_in = FALSE;
char select[MAXOCLASSES+1];
char selection[MAXOCLASSES+1];
char qbuf[BUFSZ], emptymsg[BUFSZ], pbuf[QBUFSZ];
long loss = 0L;
int cnt = 0, used = 0,
@@ -2182,7 +2182,7 @@ ask_again2:
container_contents(current_container, FALSE, FALSE);
goto ask_again2;
case 'y':
if (query_classes(select, &one_by_one, &allflag,
if (query_classes(selection, &one_by_one, &allflag,
"take out", current_container->cobj,
FALSE,
#ifndef GOLDOBJ
@@ -2190,7 +2190,7 @@ ask_again2:
#endif
&menu_on_request)) {
if (askchain((struct obj **)&current_container->cobj,
(one_by_one ? (char *)0 : select),
(one_by_one ? (char *)0 : selection),
allflag, out_container,
(int FDECL((*),(OBJ_P)))0,
0, "nodot"))
@@ -2273,14 +2273,14 @@ ask_again2:
} else {
/* traditional code */
menu_on_request = 0;
if (query_classes(select, &one_by_one, &allflag, "put in",
if (query_classes(selection, &one_by_one, &allflag, "put in",
invent, FALSE,
#ifndef GOLDOBJ
(u.ugold != 0L),
#endif
&menu_on_request)) {
(void) askchain((struct obj **)&invent,
(one_by_one ? (char *)0 : select), allflag,
(one_by_one ? (char *)0 : selection), allflag,
in_container, ck_bag, 0, "nodot");
used = 1;
} else if (menu_on_request < 0) {

View File

@@ -1057,13 +1057,13 @@ promptsep(buf, num_post_attribs)
char *buf;
int num_post_attribs;
{
const char *conj = "and ";
const char *conjuct = "and ";
if (num_post_attribs > 1
&& post_attribs < num_post_attribs && post_attribs > 1)
Strcat(buf, ",");
Strcat(buf, " ");
--post_attribs;
if (!post_attribs && num_post_attribs > 1) Strcat(buf, conj);
if (!post_attribs && num_post_attribs > 1) Strcat(buf, conjuct);
return buf;
}