sp_lev.c warnings

Fix a couple of warnings about prototype not matching function definition.
Prototype specified a narrow scalar ('boolean') but function uses old-style
definition which implicitly promotes narrow types (char,short,'boolean' to
int, float to double).  Switch prototypes to BOOLEAN_P.

A whole bunch of prototypes specify STATIC_DCL ('static') and then leave
the definition without STATIC_OVL (also 'static').  I only fixed up a
couple of those, but we risk getting somebody using an old compiler that
doesn't like
  static int foo();
  int foo() { return 42; }
Even if every comiler accepts that (I don't recall whether that was kosher
in the ancient K&R days), you can't tell by looking at the function
defintion (in the usual case where the forward declarations are at the top
of the file rather than immediately before the defintiion) whether it's
local to that file or global, so the missing STATIC_OVL qualifiers ought
to be added.
This commit is contained in:
PatR
2015-10-13 15:15:06 -07:00
parent 7451e6c3b0
commit 587279601d

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1441753941 2015/09/08 23:12:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.60 $ */
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1444774496 2015/10/13 22:14:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -32,17 +32,16 @@ STATIC_DCL boolean FDECL(m_bad_boulder_spot, (int, int));
STATIC_DCL void FDECL(create_monster, (monster *, struct mkroom *));
STATIC_DCL void FDECL(create_object, (object *, struct mkroom *));
STATIC_DCL void FDECL(create_altar, (altar *, struct mkroom *));
STATIC_DCL boolean
FDECL(search_door, (struct mkroom *, xchar *, xchar *, XCHAR_P, int));
STATIC_DCL boolean FDECL(search_door, (struct mkroom *,
xchar *, xchar *, XCHAR_P, int));
STATIC_DCL void NDECL(fix_stair_rooms);
STATIC_DCL void FDECL(create_corridor, (corridor *));
STATIC_DCL void NDECL(count_features);
STATIC_DCL boolean
FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
XCHAR_P, XCHAR_P));
long FDECL(opvar_array_length, (struct sp_coder *));
STATIC_DCL boolean FDECL(create_subroom, (struct mkroom *, XCHAR_P, XCHAR_P,
XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P));
#if 0
STATIC_DCL long FDECL(opvar_array_length, (struct sp_coder *));
#endif /*0*/
STATIC_DCL void NDECL(solidify_map);
STATIC_DCL void FDECL(splev_stack_init, (struct splevstack *));
STATIC_DCL void FDECL(splev_stack_done, (struct splevstack *));
@@ -112,9 +111,11 @@ STATIC_DCL struct opvar *FDECL(selection_logical_oper,
STATIC_DCL struct opvar *FDECL(selection_filter_mapchar,
(struct opvar *, struct opvar *));
STATIC_DCL void FDECL(selection_filter_percent, (struct opvar *, int));
STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *, boolean));
STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *,
BOOLEAN_P));
STATIC_DCL void FDECL(selection_do_grow, (struct opvar *, int));
STATIC_DCL void FDECL(selection_floodfill, (struct opvar *, int, int, boolean));
STATIC_DCL void FDECL(selection_floodfill, (struct opvar *, int, int,
BOOLEAN_P));
STATIC_DCL void FDECL(selection_do_ellipse,
(struct opvar *, int, int, int, int, int));
STATIC_DCL long FDECL(line_dist_coord, (long, long, long, long, long, long));
@@ -167,9 +168,7 @@ STATIC_DCL void FDECL(spo_shuffle_array, (struct sp_coder *));
#define Fgetc (schar) dlb_fgetc
#define New(type) (type *) alloc(sizeof(type))
#define NewTab(type, size) (type **) alloc(sizeof(type *) * (unsigned) size)
#define Free(ptr) \
if (ptr) \
free((genericptr_t)(ptr))
#define Free(ptr) if (ptr) free((genericptr_t)(ptr))
extern struct engr *head_engr;
@@ -3646,7 +3645,7 @@ int percent;
selection_setpoint(x, y, ov, 0);
}
int
STATIC_OVL int
selection_rndcoord(ov, x, y, removeit)
struct opvar *ov;
schar *x, *y;
@@ -3758,7 +3757,7 @@ int x,y;
|| levl[x][y].typ == SCORR);
}
void
STATIC_OVL void
selection_floodfill(ov, x, y, diagonals)
struct opvar *ov;
int x, y;
@@ -5041,9 +5040,11 @@ struct sp_coder *coder;
opvar_free(vname);
opvar_free(arraylen);
}
long
#if 0
STATIC_OVL long
opvar_array_length(coder)
struct sp_coder *coder;
{
@@ -5078,6 +5079,7 @@ pass:
opvar_free(vname);
return len;
}
#endif /*0*/
void
spo_shuffle_array(coder)