]> granicus.if.org Git - nethack/commitdiff
some lint cleanup
authornethack.rankin <nethack.rankin>
Tue, 21 Oct 2003 05:59:33 +0000 (05:59 +0000)
committernethack.rankin <nethack.rankin>
Tue, 21 Oct 2003 05:59:33 +0000 (05:59 +0000)
     Using
gcc -Wall -Wshadow -Wpointer-arith -Wwrite-strings \
    -Wmissing-braces -Wmissing-prototypes
with an old version of gcc.

mhitu.c: In function `hitmu':
mhitu.c:1176: warning: declaration of `buf' shadows previous local
options.c: In function `special_handling':
options.c:2712: warning: initialization discards `const' from pointer target type
options.c:2745: warning: initialization discards `const' from pointer target typ
trap.c: In function `dotrap':
trap.c:1111: warning: `saddle' might be used uninitialized in this function

The first one is no longer present in the trunk code.  The last one is
bogus as its wishy-washy wording suggests.

src/options.c
src/trap.c

index 651581a8fcfbf7c00af381e677262eb534c4ceff..b705c113813d13252489e23de3bbba2785024952 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)options.c  3.4     2003/05/19      */
+/*     SCCS Id: @(#)options.c  3.4     2003/10/20      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2704,13 +2704,13 @@ boolean setinitial,setfromfile;
        }
        destroy_nhwindow(tmpwin);
         retval = TRUE;
-    }
-    else if (!strcmp("number_pad", optname)) {
+    } else if (!strcmp("number_pad", optname)) {
        static const char *npchoices[3] =
                {"0 (off)", "1 (on)", "2 (on, DOS compatible)"};
-       char *npletters = "abc";
+       const char *npletters = "abc";
        menu_item *mode_pick = (menu_item *)0;
-        tmpwin = create_nhwindow(NHW_MENU);
+
+       tmpwin = create_nhwindow(NHW_MENU);
        start_menu(tmpwin);
        for (i = 0; i < SIZE(npchoices); i++) {
                any.a_int = i + 1;
@@ -2738,12 +2738,12 @@ boolean setinitial,setfromfile;
         }
        destroy_nhwindow(tmpwin);
         retval = TRUE;
-    }
-    else if (!strcmp("menu_headings", optname)) {
+    } else if (!strcmp("menu_headings", optname)) {
        static const char *mhchoices[3] = {"bold", "inverse", "underline"};
-       char *npletters = "biu";
+       const char *npletters = "biu";
        menu_item *mode_pick = (menu_item *)0;
-        tmpwin = create_nhwindow(NHW_MENU);
+
+       tmpwin = create_nhwindow(NHW_MENU);
        start_menu(tmpwin);
        for (i = 0; i < SIZE(mhchoices); i++) {
                any.a_int = i + 1;
index 4f5bb871b7fd9bce538368ce01e978e63c0bd0e6..d0a8869e1ffa340fb92ed1bef93bb8d00a0b7ce9 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)trap.c     3.4     2003/09/25      */
+/*     SCCS Id: @(#)trap.c     3.4     2003/10/20      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1095,7 +1095,7 @@ glovecheck:               (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
            case LANDMINE: {
 #ifdef STEED
                unsigned steed_mid = 0;
-               struct obj *saddle;
+               struct obj *saddle = 0;
 #endif
                if (Levitation || Flying) {
                    if (!already_seen && rn2(3)) break;
@@ -1106,8 +1106,8 @@ glovecheck:               (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
                                             "a trigger");
                    if (already_seen && rn2(3)) break;
                    pline("KAABLAMM!!!  %s %s%s off!",
-                           forcebungle ? "Your inept attempt sets" :
-                                         "The air currents set",
+                         forcebungle ? "Your inept attempt sets" :
+                                       "The air currents set",
                            already_seen ? a_your[trap->madeby_u] : "",
                            already_seen ? " land mine" : "it");
                } else {