From ac63f2bb6fbf3bfeeef7df0f9535cb80ac94b776 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Wed, 20 Feb 2008 01:26:13 +0000 Subject: [PATCH] more lint (trunk only) The one `anything any' that was triggering a warning was shadowing another `anything any' in the same function; no need to rename it, just remove the unnecessary declaration. Also, mark the couple of arrays with initializers that I'd noticed as static instead of letting them default to auto. The abil_to_spfx()::abil2spfx[] one might need to be redone in code as a switch if some compilers/linkers have trouble initializing it. --- src/artifact.c | 4 ++-- src/botl.c | 6 +++--- src/options.c | 19 +++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index f9bede58f..2f492e04a 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)artifact.c 3.5 2008/01/19 */ +/* SCCS Id: @(#)artifact.c 3.5 2008/02/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1584,7 +1584,7 @@ STATIC_OVL unsigned long abil_to_spfx(abil) long *abil; { - struct abil2spfx_tag { + static const struct abil2spfx_tag { long *abil; unsigned long spfx; } abil2spfx[] = { diff --git a/src/botl.c b/src/botl.c index 5cbac1050..4ef8a8e71 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)botl.c 3.5 2003/11/22 */ +/* SCCS Id: @(#)botl.c 3.5 2008/02/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1155,7 +1155,7 @@ clridx_to_s(buf, idx) char *buf; int idx; { - const char *a[] = {"bold", "inverse", "normal"}; + static const char *a[] = { "bold", "inverse", "normal" }; if (buf) { buf[0] = '\0'; @@ -1392,7 +1392,7 @@ int fldidx,thresholdtype; int behavior, under, over; anything threshold; { - + return; } # endif /* STATUS_HILITES */ diff --git a/src/options.c b/src/options.c index 76db8ea7b..b6d61a826 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)options.c 3.5 2008/01/30 */ +/* SCCS Id: @(#)options.c 3.5 2008/02/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3137,10 +3137,9 @@ boolean setinitial,setfromfile; int pick_cnt, pick_idx, opt_idx, pass; int totalapes = 0, numapes[2] = {0,0}; menu_item *pick_list = (menu_item *)0; - anything apany; char apebuf[1+BUFSZ]; /* so &apebuf[1] is BUFSZ long for getlin() */ struct autopickup_exception *ape; - static struct ape_action { + static const struct ape_action { char letr; const char *desc; } action_titles[] = { @@ -3155,12 +3154,12 @@ boolean setinitial,setfromfile; totalapes = count_ape_maps(&numapes[AP_LEAVE], &numapes[AP_GRAB]); tmpwin = create_nhwindow(NHW_MENU); start_menu(tmpwin); - apany = zeroany; + any = zeroany; for (i = 0; i < SIZE(action_titles); i++) { - apany.a_int++; + any.a_int++; /* omit list and remove if there aren't any yet */ if (!totalapes && (i == 1 || i == 2)) continue; - add_menu(tmpwin, NO_GLYPH, &apany, action_titles[i].letr, + add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE, action_titles[i].desc, #if 0 /* this ought to work but doesn't... */ (action_titles[i].letr == 'x') ? MENU_SELECTED : @@ -3202,14 +3201,14 @@ boolean setinitial,setfromfile; for (pass = AP_LEAVE; pass <= AP_GRAB; ++pass) { if (numapes[pass] == 0) continue; ape = iflags.autopickup_exceptions[pass]; - apany = zeroany; - add_menu(tmpwin, NO_GLYPH, &apany, 0, 0, iflags.menu_headings, + any = zeroany; + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, (pass == 0) ? "Never pickup" : "Always pickup", MENU_UNSELECTED); for (i = 0; i < numapes[pass] && ape; i++) { - apany.a_void = (opt_idx == 1) ? 0 : ape; + any.a_void = (opt_idx == 1) ? 0 : ape; Sprintf(apebuf, "\"%s\"", ape->pattern); - add_menu(tmpwin, NO_GLYPH, &apany, + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf, MENU_UNSELECTED); ape = ape->next; }