]> granicus.if.org Git - nethack/commitdiff
src lint
authorPatR <rankin@nethack.org>
Sat, 13 Feb 2016 09:59:51 +0000 (01:59 -0800)
committerPatR <rankin@nethack.org>
Sat, 13 Feb 2016 09:59:51 +0000 (01:59 -0800)
Another OS upgrade (OSX 10.6.8 -> 10.8.5) with different toolset,
another change in compiler behavior.  Earlier 'gcc -Wwrite-strings'
didn't complain about passing string literals as 'char *' paremeters
if there was no prototype in scope.  This one found one or two of
those in options.c and several in makedefs.c (fix coming soon in a
separate commit...).  This adds some missing prototypes and reorders
the existing ones to match their order within the file.  There were
also several functions which were declared static in their advance
declarations but not in the definitions, which can be confusing when
reading the source.

src/attrib.c
src/options.c

index 4d4df2dff4a66ca08a77cf2ec56f221ae6a56ead..63ae7269c488163cfc7c50d62d1cf0b444cd94f2 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 attrib.c        $NHDT-Date: 1451111134 2015/12/26 06:25:34 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.54 $ */
+/* NetHack 3.6 attrib.c        $NHDT-Date: 1455357587 2016/02/13 09:59:47 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.55 $ */
 /*      Copyright 1988, 1989, 1990, 1992, M. Stephenson           */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -710,6 +710,8 @@ long frommask;
             abil = orc_abil;
             break;
         case PM_HUMAN:
+            abil = hum_abil;
+            break;
         default:
             break;
         }
index 15c6ec23f0c3f290f940439c5b85d36478a8aa1c..c200ae1d2c747f8fe4ab80a219f6f65895042e50 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 options.c       $NHDT-Date: 1454979782 2016/02/09 01:03:02 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.263 $ */
+/* NetHack 3.6 options.c       $NHDT-Date: 1455357588 2016/02/13 09:59:48 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.264 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -495,7 +495,6 @@ static short n_menu_mapped = 0;
 
 static boolean initial, from_file;
 
-STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int));
 STATIC_DCL void FDECL(nmcpy, (char *, const char *, int));
 STATIC_DCL void FDECL(escapes, (const char *, char *));
 STATIC_DCL void FDECL(rejectoption, (const char *));
@@ -504,36 +503,41 @@ STATIC_DCL char *FDECL(string_for_opt, (char *, BOOLEAN_P));
 STATIC_DCL char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P));
 STATIC_DCL void FDECL(bad_negation, (const char *, BOOLEAN_P));
 STATIC_DCL int FDECL(change_inv_order, (char *));
-STATIC_DCL void FDECL(oc_to_str, (char *, char *));
-STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
-STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *));
-STATIC_DCL boolean FDECL(special_handling, (const char *,
-                                            BOOLEAN_P, BOOLEAN_P));
 STATIC_DCL void FDECL(warning_opts, (char *, const char *));
+STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
 STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
 STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
 
-STATIC_OVL void FDECL(wc_set_font_name, (int, char *));
-STATIC_OVL int FDECL(wc_set_window_colors, (char *));
-STATIC_OVL boolean FDECL(is_wc_option, (const char *));
-STATIC_OVL boolean FDECL(wc_supported, (const char *));
-STATIC_OVL boolean FDECL(is_wc2_option, (const char *));
-STATIC_OVL boolean FDECL(wc2_supported, (const char *));
-STATIC_DCL void FDECL(remove_autopickup_exception,
-                      (struct autopickup_exception *));
-STATIC_OVL int FDECL(count_ape_maps, (int *, int *));
 STATIC_DCL const char *FDECL(attr2attrname, (int));
 STATIC_DCL int NDECL(query_color);
-STATIC_DCL int NDECL(query_msgtype);
 STATIC_DCL int FDECL(query_attr, (const char *));
 STATIC_DCL const char * FDECL(msgtype2name, (int));
+STATIC_DCL int NDECL(query_msgtype);
 STATIC_DCL boolean FDECL(msgtype_add, (int, char *));
 STATIC_DCL void FDECL(free_one_msgtype, (int));
 STATIC_DCL int NDECL(msgtype_count);
 STATIC_DCL boolean FDECL(add_menu_coloring_parsed, (char *, int, int));
 STATIC_DCL void FDECL(free_one_menu_coloring, (int));
 STATIC_DCL int NDECL(count_menucolors);
+
+STATIC_DCL void FDECL(oc_to_str, (char *, char *));
+STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int));
+STATIC_DCL void FDECL(opts_add_others, (winid, const char *, int,
+                                        char *, int));
 STATIC_DCL int FDECL(handle_add_list_remove, (const char *, int));
+STATIC_DCL boolean FDECL(special_handling, (const char *,
+                                            BOOLEAN_P, BOOLEAN_P));
+STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *));
+STATIC_DCL void FDECL(remove_autopickup_exception,
+                      (struct autopickup_exception *));
+STATIC_DCL int FDECL(count_ape_maps, (int *, int *));
+
+STATIC_DCL boolean FDECL(is_wc_option, (const char *));
+STATIC_DCL boolean FDECL(wc_supported, (const char *));
+STATIC_DCL boolean FDECL(is_wc2_option, (const char *));
+STATIC_DCL boolean FDECL(wc2_supported, (const char *));
+STATIC_DCL void FDECL(wc_set_font_name, (int, char *));
+STATIC_DCL int FDECL(wc_set_window_colors, (char *));
 
 void
 reglyph_darkroom()
@@ -1300,7 +1304,7 @@ char *str;
     return c;
 }
 
-const char *
+STATIC_OVL const char *
 attr2attrname(attr)
 int attr;
 {
@@ -1312,7 +1316,7 @@ int attr;
     return (char *) 0;
 }
 
-int
+STATIC_OVL int
 query_color()
 {
     winid tmpwin;
@@ -1341,7 +1345,7 @@ query_color()
     return -1;
 }
 
-int
+STATIC_OVL int
 query_attr(prompt)
 const char *prompt;
 {
@@ -1382,7 +1386,7 @@ static const struct {
     { "norep", MSGTYP_NOREP, "Do not repeat the message" }
 };
 
-const char *
+STATIC_OVL const char *
 msgtype2name(typ)
 int typ;
 {
@@ -1422,7 +1426,7 @@ query_msgtype()
     return -1;
 }
 
-boolean
+STATIC_OVL boolean
 msgtype_add(typ, pattern)
 int typ;
 char *pattern;
@@ -1466,7 +1470,7 @@ msgtype_free()
     plinemsg_types = (struct plinemsg_type *) 0;
 }
 
-void
+STATIC_OVL void
 free_one_msgtype(idx)
 int idx; /* 0 .. */
 {
@@ -1529,7 +1533,7 @@ int hide_mask;
     }
 }
 
-int
+STATIC_OVL int
 msgtype_count()
 {
     int c = 0;
@@ -1678,7 +1682,7 @@ free_menu_coloring()
     }
 }
 
-void
+STATIC_OVL void
 free_one_menu_coloring(idx)
 int idx; /* 0 .. */
 {
@@ -1704,7 +1708,7 @@ int idx; /* 0 .. */
     }
 }
 
-int
+STATIC_OVL int
 count_menucolors()
 {
     int count = 0;
@@ -3595,13 +3599,14 @@ int indexoffset;    /* value to add to index in compopt[], or zero
 STATIC_OVL void
 opts_add_others(win, name, id, bufx, nset)
 winid win;
-char *name;
+const char *name;
 int id;
 char *bufx;
 int nset;
 {
     char buf[BUFSZ], buf2[BUFSZ];
     anything any = zeroany;
+
     any.a_int = id;
     if (!bufx)
         Sprintf(buf2, n_currently_set, nset);
@@ -3856,7 +3861,7 @@ doset() /* changing options via menu by Per Liboriussen */
     return 0;
 }
 
-int
+STATIC_OVL int
 handle_add_list_remove(optname, numtotal)
 const char *optname;
 int numtotal;