mdlib.c tweaks

Eliminate a couple of warnings about unused static routines.
That led to a couple of other things.

I hope I got host vs target right in the mdlib.c '#if's.
This commit is contained in:
PatR
2019-11-30 16:59:35 -08:00
parent ef59ceaabc
commit b7689128e7
4 changed files with 36 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mdlib.c $NHDT-Date: 1575076762 2019/11/30 01:19:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $ */
/* NetHack 3.7 mdlib.c $NHDT-Date: 1575161954 2019/12/01 00:59:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.6 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* Copyright (c) M. Stephenson, 1990, 1991. */
@@ -47,8 +47,20 @@
#endif
#endif /* !MAKEDEFS_C */
void NDECL(build_options);
#if defined(MAKEDEFS_C) || defined(CROSSCOMPILE_TARGET)
/* REPRODUCIBLE_BUILD will change this to TRUE */
static boolean date_via_env = FALSE;
static char *FDECL(version_string, (char *, const char *));
static char *FDECL(version_id_string, (char *, const char *));
static char *FDECL(bannerc_string, (char *, const char *));
static int FDECL(case_insensitive_comp, (const char *, const char *));
static void NDECL(make_version);
static char *FDECL(eos, (char *));
#endif /* MAKEDEFS_C || CROSSCOMPILE_TARGET */
void NDECL(build_options);
static void FDECL(opt_out_words, (char *, int *));
static void NDECL(build_savebones_compat_string);
static int idxopttext, done_runtime_opt_init_once = 0;
@@ -59,16 +71,6 @@ char optbuf[BUFSZ];
static struct version_info version;
static const char opt_indent[] = " ";
#ifndef MAKEDEFS_C
static int FDECL(case_insensitive_comp, (const char *, const char *));
static void NDECL(make_version);
static char *FDECL(version_id_string, (char *, const char *));
static char *FDECL(version_string, (char *, const char *));
static char *FDECL(eos, (char *));
/* REPRODUCIBLE_BUILD will change this to TRUE */
static boolean date_via_env = FALSE;
#endif /* !MAKEDEFS_C */
struct win_info {
const char *id, /* DEFAULT_WINDOW_SYS string */
*name; /* description, often same as id */
@@ -220,6 +222,8 @@ make_version()
return;
}
#if defined(MAKEDEFS_C) || defined(CROSSCOMPILE_TARGET)
static char *
version_string(outbuf, delim)
char *outbuf;
@@ -262,6 +266,8 @@ const char *build_date;
return outbuf;
}
/* still within #if MAKDEFS_C || CROSSCOMPILE_TARGET */
static char *
bannerc_string(outbuf, build_date)
char *outbuf;
@@ -293,6 +299,8 @@ const char *build_date;
return outbuf;
}
#endif /* MAKEDEFS_C || CROSSCOMPILE_TARGET */
static int
case_insensitive_comp(s1, s2)
const char *s1;
@@ -653,7 +661,8 @@ build_options()
(const char *) 0
};
/* add lua copyright notice */
/* add lua copyright notice;
":TAG:" substitutions are deferred to caller */
for (i = 0; lua_info[i]; ++i) {
opttext[idxopttext] = strdup(lua_info[i]);
if (idxopttext < (MAXOPT - 1))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 nhlua.c $NHDT-Date: 1575071986 2019/11/29 23:59:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.12 $ */
/* NetHack 3.6 nhlua.c $NHDT-Date: 1575161963 2019/12/01 00:59:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */
/* Copyright (c) 2018 by Pasi Kallinen */
/* NetHack may be freely redistributed. See license for details. */
@@ -815,7 +815,7 @@ const char *fname;
dlb_fseek(fh, 0L, SEEK_END);
buflen = dlb_ftell(fh);
buf = (char *) alloc(sizeof(char) * (buflen + 1));
buf = (char *) alloc(buflen + 1);
dlb_fseek(fh, 0L, SEEK_SET);
if ((cnt = dlb_fread(buf, 1, buflen, fh)) != buflen) {
@@ -919,12 +919,18 @@ get_lua_version()
lua_getglobal(L, "_VERSION");
if (lua_isstring(L, -1))
vs = lua_tolstring (L, -1, &len);
if (vs && (int) len < sizeof g.lua_ver - 1)
if (vs && len < sizeof g.lua_ver) {
if (!strncmpi(vs, "Lua", 3)) {
vs += 3;
if (*vs == '-')
vs += 1;
}
Strcpy(g.lua_ver, vs);
}
}
lua_close(L);
#ifdef LUA_COPYRIGHT
if (sizeof LUA_COPYRIGHT < sizeof g.lua_copyright - 1)
if (sizeof LUA_COPYRIGHT <= sizeof g.lua_copyright)
Strcpy(g.lua_copyright, LUA_COPYRIGHT);
#endif
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 version.c $NHDT-Date: 1575076767 2019/11/30 01:19:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.63 $ */
/* NetHack 3.6 version.c $NHDT-Date: 1575161965 2019/12/01 00:59:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -303,10 +303,8 @@ static struct rt_opt {
const char *token, *value;
} rt_opts[] = {
{ ":PATMATCH:", regex_id },
{ ":LUAVERSION:", (const char *) g.lua_ver + 3 }, /* +3 skip past "Lua" */
#ifdef LUA_COPYRIGHT
{ ":LUAVERSION:", (const char *) g.lua_ver },
{ ":LUACOPYRIGHT:", (const char *) g.lua_copyright },
#endif
};
/*

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 makedefs.c $NHDT-Date: 1575076769 2019/11/30 01:19:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.167 $ */
/* NetHack 3.6 makedefs.c $NHDT-Date: 1575161967 2019/12/01 00:59:27 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.168 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* Copyright (c) M. Stephenson, 1990, 1991. */
@@ -216,14 +216,7 @@ extern unsigned _stklen = STKSIZ;
* information for the target environment during the game compile portion
* under the cross-compiler and/or at runtime in some cases.
*/
/* These actually reside in src/mdlib.c */
static int FDECL(case_insensitive_comp, (const char *, const char *));
static void NDECL(make_version);
static char *FDECL(version_id_string, (char *, const char *));
static char *FDECL(version_string, (char *, const char *));
static char *FDECL(eos, (char *));
/* REPRODUCIBLE_BUILD will change this to TRUE */
static boolean date_via_env = FALSE;
#include "../src/mdlib.c"
#ifdef MACsansMPWTOOL