]> granicus.if.org Git - nethack/commitdiff
more lint (trunk only)
authornethack.rankin <nethack.rankin>
Wed, 20 Feb 2008 01:26:13 +0000 (01:26 +0000)
committernethack.rankin <nethack.rankin>
Wed, 20 Feb 2008 01:26:13 +0000 (01:26 +0000)
     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
src/botl.c
src/options.c

index f9bede58f09120281c51bad355596dab9837f88d..2f492e04a4107785742a9f7c467edb09cf9a0e1f 100644 (file)
@@ -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[] = {
index 5cbac1050f25b3e2834da085ab61e600871d498e..4ef8a8e712e7299d440845a54a2cafc5584a8f60 100644 (file)
@@ -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 */
 
index 76db8ea7bcb3e4032811c308f6471dc0f1c06809..b6d61a826502c5b29df573908f865b204d89d834 100644 (file)
@@ -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;
                    }