From 79648c6ce20da4863e2d5afd46e8af7fa4c3c931 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 15 Mar 2024 16:00:14 -0400 Subject: [PATCH] some variables not referenced in another translation unit made static Also adds some cross-refence comments for some variables that are referenced in another translation unit. --- src/allmain.c | 15 ++++++------- src/attrib.c | 4 +++- src/botl.c | 3 ++- src/cmd.c | 9 +++++--- src/decl.c | 58 +++++++++++++++++++++++++-------------------------- src/dlb.c | 4 ++-- src/do_name.c | 3 ++- src/drawing.c | 5 +++++ src/eat.c | 3 ++- src/files.c | 8 +++---- src/insight.c | 3 ++- src/mdlib.c | 2 +- src/monst.c | 5 ++++- src/mthrowu.c | 2 +- src/music.c | 2 +- src/nhlua.c | 2 +- src/o_init.c | 4 ++-- src/objects.c | 4 ++-- src/options.c | 2 +- src/pager.c | 2 +- src/potion.c | 4 ++-- src/shk.c | 2 +- src/shknam.c | 1 + src/sounds.c | 2 +- src/symbols.c | 1 + src/topten.c | 3 ++- src/utf8map.c | 4 ++-- src/vision.c | 3 ++- src/worn.c | 2 +- src/zap.c | 1 + util/panic.c | 2 +- 31 files changed, 94 insertions(+), 71 deletions(-) diff --git a/src/allmain.c b/src/allmain.c index a0dfd803f..f2b113b0b 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1109,6 +1109,7 @@ timet_delta(time_t etim, time_t stim) /* end and start times */ #if !defined(NODUMPENUMS) || defined(ENHANCED_SYMBOLS) /* monsdump[] and objdump[] are also used in utf8map.c */ + #define DUMP_ENUMS struct enum_dump monsdump[] = { #include "monsters.h" @@ -1124,46 +1125,46 @@ struct enum_dump objdump[] = { }; #define DUMP_ENUMS_PCHAR -struct enum_dump defsym_cmap_dump[] = { +static struct enum_dump defsym_cmap_dump[] = { #include "defsym.h" { MAXPCHARS, "MAXPCHARS" }, }; #undef DUMP_ENUMS_PCHAR #define DUMP_ENUMS_MONSYMS -struct enum_dump defsym_mon_syms_dump[] = { +static struct enum_dump defsym_mon_syms_dump[] = { #include "defsym.h" { MAXMCLASSES, "MAXMCLASSES" }, }; #undef DUMP_ENUMS_MONSYMS #define DUMP_ENUMS_MONSYMS_DEFCHAR -struct enum_dump defsym_mon_defchars_dump[] = { +static struct enum_dump defsym_mon_defchars_dump[] = { #include "defsym.h" }; #undef DUMP_ENUMS_MONSYMS_DEFCHAR #define DUMP_ENUMS_OBJCLASS_DEFCHARS -struct enum_dump objclass_defchars_dump[] = { +static struct enum_dump objclass_defchars_dump[] = { #include "defsym.h" }; #undef DUMP_ENUMS_OBJCLASS_DEFCHARS #define DUMP_ENUMS_OBJCLASS_CLASSES -struct enum_dump objclass_classes_dump[] = { +static struct enum_dump objclass_classes_dump[] = { #include "defsym.h" { MAXOCLASSES, "MAXOCLASSES" }, }; #undef DUMP_ENUMS_OBJCLASS_CLASSES #define DUMP_ENUMS_OBJCLASS_SYMS -struct enum_dump objclass_syms_dump[] = { +static struct enum_dump objclass_syms_dump[] = { #include "defsym.h" }; #undef DUMP_ENUMS_OBJCLASS_SYMS #define DUMP_ARTI_ENUM -struct enum_dump arti_enum_dump[] = { +static struct enum_dump arti_enum_dump[] = { #include "artilist.h" { AFTER_LAST_ARTIFACT, "AFTER_LAST_ARTIFACT" } }; diff --git a/src/attrib.c b/src/attrib.c index f2b997209..1bad88f77 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -14,7 +14,9 @@ static const char *const minusattr[] = { "weak", "stupid", "foolish", "clumsy", "fragile", "repulsive" }; -/* also used by enlightenment for non-abbreviated status info */ +/* also used by enlightenment in insight.c for non-abbreviated status info */ +extern const char *const attrname[6]; + const char *const attrname[] = { "strength", "intelligence", "wisdom", "dexterity", "constitution", "charisma" }; diff --git a/src/botl.c b/src/botl.c index e37ffd8a8..49afeb19a 100644 --- a/src/botl.c +++ b/src/botl.c @@ -10,6 +10,7 @@ extern const char *const hu_stat[]; /* defined in eat.c */ +/* also used in insight.c */ const char *const enc_stat[] = { "", "Burdened", "Stressed", "Strained", "Overtaxed", "Overloaded" @@ -591,7 +592,7 @@ static struct istat_s initblstats[MAXBLSTATS] = { #ifdef STATUS_HILITES -const struct condmap condition_aliases[] = { +static const struct condmap condition_aliases[] = { { "strangled", BL_MASK_STRNGL }, { "all", BL_MASK_BAREH | BL_MASK_BLIND | BL_MASK_BUSY | BL_MASK_CONF | BL_MASK_DEAF | BL_MASK_ELF_IRON diff --git a/src/cmd.c b/src/cmd.c index 27c8ed2ab..b420f0c98 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -144,8 +144,10 @@ static char *doc_extcmd_flagstr(winid, const struct ext_func_tab *); static const char *readchar_queue = ""; -/* for rejecting attempts to use wizard mode commands */ +/* for rejecting attempts to use wizard mode commands + * Also used in wizcmds.c */ const char unavailcmd[] = "Unavailable command '%s'."; + /* for rejecting #if !SHELL, !SUSPEND */ static const char cmdnotavail[] = "'%s' command not available."; @@ -1038,7 +1040,8 @@ makemap_prepost(boolean pre, boolean wiztower) } /* temporary? hack, since level type codes aren't the same as screen - symbols and only the latter have easily accessible descriptions */ + symbols and only the latter have easily accessible descriptions. + Also used by wizcmds.c */ const char *levltyp[MAX_TYPE + 2] = { "stone", "vertical wall", "horizontal wall", "top-left corner wall", "top-right corner wall", "bottom-left corner wall", @@ -2029,7 +2032,7 @@ static const struct { { 0, (const char *) 0, FALSE } }; -int extcmdlist_length = SIZE(extcmdlist) - 1; +static int extcmdlist_length = SIZE(extcmdlist) - 1; /* get entry i in the extended commands list. for windowport use. */ struct ext_func_tab * diff --git a/src/decl.c b/src/decl.c index 2f8af0349..7b11846f8 100644 --- a/src/decl.c +++ b/src/decl.c @@ -51,7 +51,7 @@ const struct c_common_strings c_common_strings = { "mon", "you" } }; -const struct savefile_info default_sfinfo = { +static const struct savefile_info default_sfinfo = { #ifdef NHSTDC 0x00000000UL #else @@ -143,7 +143,7 @@ const char *ARGV0; #define IVMAGIC 0xdeadbeef -const struct Role urole_init_data = { +static const struct Role urole_init_data = { { "Undefined", 0 }, { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, @@ -168,7 +168,7 @@ const struct Role urole_init_data = { -3 }; -const struct Race urace_init_data = { +static const struct Race urace_init_data = { "something", "undefined", "something", @@ -191,7 +191,7 @@ const struct Race urace_init_data = { struct display_hints disp = { 0 }; -const struct instance_globals_a g_init_a = { +static const struct instance_globals_a g_init_a = { /* artifact.c */ /* decl.c */ UNDEFINED_PTR, /* afternmv */ @@ -221,7 +221,7 @@ const struct instance_globals_a g_init_a = { IVMAGIC /* a_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_b g_init_b = { +static const struct instance_globals_b g_init_b = { /* botl.c */ { { { NULL, NULL, 0L, FALSE, FALSE, 0, 0U, { 0 }, { 0 }, NULL, 0, 0, 0 #ifdef STATUS_HILITES @@ -258,7 +258,7 @@ const struct instance_globals_b g_init_b = { IVMAGIC /* b_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_c g_init_c = { +static const struct instance_globals_c g_init_c = { UNDEFINED_VALUES, /* command_queue */ /* botl.c */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -310,7 +310,7 @@ const struct instance_globals_c g_init_c = { IVMAGIC /* c_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_d g_init_d = { +static const struct instance_globals_d g_init_d = { /* decl.c */ 0, /* doorindex */ 0L, /* done_money */ @@ -349,7 +349,7 @@ const struct instance_globals_d g_init_d = { IVMAGIC /* d_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_e g_init_e = { +static const struct instance_globals_e g_init_e = { /* cmd.c */ WIN_ERR, /* en_win */ FALSE, /* en_via_menu */ @@ -365,7 +365,7 @@ const struct instance_globals_e g_init_e = { IVMAGIC /* e_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_f g_init_f = { +static const struct instance_globals_f g_init_f = { /* decl.c */ UNDEFINED_PTR, /* ftrap */ { NULL }, /* fqn_prefix */ @@ -384,7 +384,7 @@ const struct instance_globals_f g_init_f = { IVMAGIC /* f_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_g g_init_g = { +static const struct instance_globals_g g_init_g = { /* display.c */ { { { 0 } } }, /* gbuf */ UNDEFINED_VALUES, /* gbuf_start */ @@ -416,7 +416,7 @@ const struct instance_globals_g g_init_g = { IVMAGIC /* g_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_h g_init_h = { +static const struct instance_globals_h g_init_h = { /* decl.c */ NULL, /* hname */ 0, /* hackpid */ @@ -436,7 +436,7 @@ const struct instance_globals_h g_init_h = { IVMAGIC /* h_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_i g_init_i = { +static const struct instance_globals_i g_init_i = { /* decl.c */ 0, /* in_doagain */ { 0, 0 } , /* inv_pos */ @@ -460,14 +460,14 @@ const struct instance_globals_i g_init_i = { IVMAGIC /* i_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_j g_init_j = { +static const struct instance_globals_j g_init_j = { /* apply.c */ 0, /* jumping_is_magic */ TRUE, /* havestate*/ IVMAGIC /* j_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_k g_init_k = { +static const struct instance_globals_k g_init_k = { /* decl.c */ UNDEFINED_PTR, /* kickedobj */ DUMMY, /* killer */ @@ -477,7 +477,7 @@ const struct instance_globals_k g_init_k = { IVMAGIC /* k_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_l g_init_l = { +static const struct instance_globals_l g_init_l = { /* cmd.c */ UNDEFINED_VALUE, /* last_command_count */ /* decl.c */ @@ -533,7 +533,7 @@ const struct instance_globals_l g_init_l = { IVMAGIC /* l_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_m g_init_m = { +static const struct instance_globals_m g_init_m = { /* apply.c */ 0, /* mkot_trap_warn_count */ /* botl.c */ @@ -586,7 +586,7 @@ const struct instance_globals_m g_init_m = { IVMAGIC /* m_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_n g_init_n = { +static const struct instance_globals_n g_init_n = { /* botl.c */ 0, /* now_or_before_idx */ /* decl.c */ @@ -626,7 +626,7 @@ const struct instance_globals_n g_init_n = { IVMAGIC /* n_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_o g_init_o = { +static const struct instance_globals_o g_init_o = { /* dbridge.c */ { { 0 } }, /* occupants */ /* decl.c */ @@ -666,7 +666,7 @@ const struct instance_globals_o g_init_o = { IVMAGIC /* o_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_p g_init_p = { +static const struct instance_globals_p g_init_p = { /* apply.c */ -1, /* polearm_range_min */ -1, /* polearm_range_max */ @@ -706,14 +706,14 @@ const struct instance_globals_p g_init_p = { IVMAGIC /* p_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_q g_init_q = { +static const struct instance_globals_q g_init_q = { /* quest.c */ DUMMY, /* quest_status */ TRUE, /* havestate*/ IVMAGIC /* q_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_r g_init_r = { +static const struct instance_globals_r g_init_r = { /* decl.c */ { DUMMY }, /* rooms */ /* symbols.c */ @@ -736,7 +736,7 @@ const struct instance_globals_r g_init_r = { IVMAGIC /* r_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_s g_init_s = { +static const struct instance_globals_s g_init_s = { /* artifact.c */ 0, /* spec_dbon_applies */ /* decl.c */ @@ -796,7 +796,7 @@ const struct instance_globals_s g_init_s = { IVMAGIC /* s_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_t g_init_t = { +static const struct instance_globals_t g_init_t = { /* apply.c */ UNDEFINED_VALUES, /* trapinfo */ /* decl.c */ @@ -833,7 +833,7 @@ const struct instance_globals_t g_init_t = { IVMAGIC /* t_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_u g_init_u = { +static const struct instance_globals_u g_init_u = { /* botl.c */ FALSE, /* update_all */ /* decl.c */ @@ -848,7 +848,7 @@ const struct instance_globals_u g_init_u = { IVMAGIC /* u_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_v g_init_v = { +static const struct instance_globals_v g_init_v = { /* botl.c */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* valset */ @@ -874,7 +874,7 @@ const struct instance_globals_v g_init_v = { IVMAGIC /* v_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_w g_init_w = { +static const struct instance_globals_w g_init_w = { /* decl.c */ 0, /* warn_obj_cnt */ 0L, /* wailmsg */ @@ -892,7 +892,7 @@ const struct instance_globals_w g_init_w = { IVMAGIC /* w_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_x g_init_x = { +static const struct instance_globals_x g_init_x = { /* decl.c */ (COLNO - 1) & ~1, /* x_maze_max */ /* lock.c */ @@ -909,7 +909,7 @@ const struct instance_globals_x g_init_x = { IVMAGIC /* x_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_y g_init_y = { +static const struct instance_globals_y g_init_y = { /* decl.c */ (ROWNO - 1) & ~1, /* y_maze_max */ DUMMY, /* youmonst */ @@ -926,7 +926,7 @@ const struct instance_globals_y g_init_y = { IVMAGIC /* y_magic to validate that structure layout has been preserved */ }; -const struct instance_globals_z g_init_z = { +static const struct instance_globals_z g_init_z = { /* mon.c */ FALSE, /* zombify */ /* muse.c */ diff --git a/src/dlb.c b/src/dlb.c index cbcaa7bad..0cac0f1f2 100644 --- a/src/dlb.c +++ b/src/dlb.c @@ -393,7 +393,7 @@ lib_dlb_ftell(dlb *dp) return dp->mark; } -const dlb_procs_t lib_dlb_procs = { lib_dlb_init, lib_dlb_cleanup, +static const dlb_procs_t lib_dlb_procs = { lib_dlb_init, lib_dlb_cleanup, lib_dlb_fopen, lib_dlb_fclose, lib_dlb_fread, lib_dlb_fseek, lib_dlb_fgets, lib_dlb_fgetc, @@ -402,7 +402,7 @@ const dlb_procs_t lib_dlb_procs = { lib_dlb_init, lib_dlb_cleanup, #endif /* DLBLIB */ #ifdef DLBRSRC -const dlb_procs_t rsrc_dlb_procs = { rsrc_dlb_init, rsrc_dlb_cleanup, +static const dlb_procs_t rsrc_dlb_procs = { rsrc_dlb_init, rsrc_dlb_cleanup, rsrc_dlb_fopen, rsrc_dlb_fclose, rsrc_dlb_fread, rsrc_dlb_fseek, rsrc_dlb_fgets, rsrc_dlb_fgetc, diff --git a/src/do_name.c b/src/do_name.c index 6a3eed42d..b7e9ab626 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1318,7 +1318,8 @@ obj_pmname(struct obj *obj) /* used by bogusmon(next) and also by init_CapMons(rumors.c); bogon_is_pname(below) checks a hard-coded subset of these rather than - use this list */ + use this list. + Also used in rumors.c */ const char bogon_codes[] = "-_+|="; /* see dat/bonusmon.txt */ /* fake monsters used to be in a hard-coded array, now in a data file */ diff --git a/src/drawing.c b/src/drawing.c index 83dff55c5..7881e1f8e 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -9,6 +9,11 @@ #include "wintype.h" #include "sym.h" +extern const struct symparse loadsyms[]; +extern const struct class_sym def_oc_syms[MAXOCLASSES]; +extern const struct class_sym def_monsyms[MAXMCLASSES]; +extern const uchar def_r_oc_syms[MAXOCLASSES]; + /* Relevant header information in rm.h, objclass.h, sym.h, defsym.h. */ /* Default object class symbols. See objclass.h. diff --git a/src/eat.c b/src/eat.c index 73a887a11..2599dc508 100644 --- a/src/eat.c +++ b/src/eat.c @@ -64,7 +64,8 @@ static int tin_ok(struct obj *); #define nonrotting_food(otyp) \ ((otyp) == LEMBAS_WAFER || (otyp) == CRAM_RATION) -/* see hunger states in hack.h - texts used on bottom line */ +/* see hunger states in hack.h - texts used on bottom line + Also used in botl.c and insight.c */ const char *const hu_stat[] = { "Satiated", " ", "Hungry ", "Weak ", "Fainting", "Fainted ", "Starved " diff --git a/src/files.c b/src/files.c index 9a8c35f2f..477814bc3 100644 --- a/src/files.c +++ b/src/files.c @@ -492,7 +492,7 @@ fopen_datafile(const char *filename, const char *mode, int prefix) /* ---------- EXTERNAL FILE SUPPORT ----------- */ /* determine byte order */ -const int bei = 1; +static const int bei = 1; #define IS_BIGENDIAN() ( (*(char*)&bei) == 0 ) void @@ -1824,7 +1824,7 @@ docompress_file(const char *filename, boolean uncomp) static int lockfd = -1; /* for lock_file() to pass to unlock_file() */ #endif #ifdef USE_FCNTL -struct flock sflock; /* for unlocking, same as above */ +static struct flock sflock; /* for unlocking, same as above */ #endif #if defined(HANGUPHANDLING) @@ -2082,7 +2082,7 @@ unlock_file(const char *filename) /* ---------- BEGIN CONFIG FILE HANDLING ----------- */ -const char *default_configfile = +static const char *default_configfile = #ifdef UNIX ".nethackrc"; #else @@ -2097,7 +2097,7 @@ const char *default_configfile = #endif #endif -/* used for messaging */ +/* used for messaging. Also used in options.c */ char configfile[BUFSZ]; #ifdef MSDOS diff --git a/src/insight.c b/src/insight.c index b81ece08e..ddd7677c5 100644 --- a/src/insight.c +++ b/src/insight.c @@ -2547,7 +2547,8 @@ show_gamelog(int final) * Vanquished monsters. */ -/* the two uppercase choices are implemented but suppressed from menu */ +/* the two uppercase choices are implemented but suppressed from menu. + also used in options.c */ const char *const vanqorders[NUM_VANQ_ORDER_MODES][3] = { { "t", "traditional: by monster level", "traditional: by monster level, by internal monster index" }, diff --git a/src/mdlib.c b/src/mdlib.c index f2aae69a7..960feaa10 100644 --- a/src/mdlib.c +++ b/src/mdlib.c @@ -95,7 +95,7 @@ static char *opttext[MAXOPT] = { 0 }; ((void) ((idxopttext < MAXOPT) \ ? (opttext[idxopttext++] = dupstr(line)) \ : 0)) -char optbuf[COLBUFSZ]; +static char optbuf[COLBUFSZ]; static struct version_info version; static const char opt_indent[] = " "; diff --git a/src/monst.c b/src/monst.c index 5518e8e44..4b7f57fb1 100644 --- a/src/monst.c +++ b/src/monst.c @@ -10,6 +10,9 @@ #include "color.h" +extern const struct attack c_sa_yes[NATTK]; +extern const struct attack c_sa_no[NATTK]; + #define NO_ATTK { 0, 0, 0, 0 } /* monster type with single name */ @@ -32,7 +35,7 @@ #define ATTK(at, ad, n, d) { at, ad, n, d } #define A(a1, a2, a3, a4, a5, a6) { a1, a2, a3, a4, a5, a6 } -struct permonst mons_init[NUMMONS + 1] = { +static struct permonst mons_init[NUMMONS + 1] = { #include "monsters.h" /* * Array terminator, added to the end of the entries in monsters.h. diff --git a/src/mthrowu.c b/src/mthrowu.c index 09b67def5..de835b8de 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -26,7 +26,7 @@ static NEARDATA const char *breathwep[] = { }; /* hallucinatory ray types */ -const char *const hallublasts[] = { +static const char *const hallublasts[] = { "asteroids", "beads", "bubbles", "butterflies", "champagne", "chaos", "coins", "cotton candy", "crumbs", "dark matter", "darkness", "dust specks", "emoticons", "emotions", "entropy", "flowers", "foam", "fog", "gamma rays", diff --git a/src/music.c b/src/music.c index 06ebe724a..5b25eab19 100644 --- a/src/music.c +++ b/src/music.c @@ -472,7 +472,7 @@ generic_lvl_desc(void) return "dungeon"; } -const char *beats[] = { +static const char *beats[] = { "stepper", "one drop", "slow two", "triple stroke roll", "double shuffle", "half-time shuffle", "second line", "train" }; diff --git a/src/nhlua.c b/src/nhlua.c index d6bed268f..16a74cc4f 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -329,7 +329,7 @@ nhl_add_table_entry_region(lua_State *L, const char *name, coordxy x1, /* converting from special level "map character" to levl location type and back. order here is important. */ -const struct { +static const struct { char ch; schar typ; } char2typ[] = { diff --git a/src/o_init.c b/src/o_init.c index d56e0689f..fee72b3e8 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -562,8 +562,8 @@ sortloot_descr(int otyp, char *outbuf) #define DISCO_ALPHABYCLASS 2 /* alphabetized within each class */ #define DISCO_ALPHABETIZED 3 /* alphabetized across all classes */ /* also used in options.c (optfn_sortdiscoveries) */ -const char disco_order_let[] = "osca"; -const char *const disco_orders_descr[] = { +static const char disco_order_let[] = "osca"; +static const char *const disco_orders_descr[] = { "by order of discovery within each class", "sortloot order (by class with some sub-class groupings)", "alphabetical within each class", diff --git a/src/objects.c b/src/objects.c index a7ef8d52c..45ceaeeab 100644 --- a/src/objects.c +++ b/src/objects.c @@ -10,13 +10,13 @@ #include "color.h" #include "objclass.h" -NEARDATA struct objdescr obj_descr_init[NUM_OBJECTS + 1] = { +static struct objdescr obj_descr_init[NUM_OBJECTS + 1] = { #define OBJECTS_DESCR_INIT #include "objects.h" #undef OBJECTS_DESCR_INIT }; -NEARDATA struct objclass obj_init[NUM_OBJECTS + 1] = { +static struct objclass obj_init[NUM_OBJECTS + 1] = { #define OBJECTS_INIT #include "objects.h" #undef OBJECTS_INIT diff --git a/src/options.c b/src/options.c index f5e562795..d8bc9c233 100644 --- a/src/options.c +++ b/src/options.c @@ -111,7 +111,7 @@ static struct allopt_t allopt[SIZE(allopt_init)]; /* use rest of file */ -extern char configfile[]; /* for messages */ +extern char configfile[]; /* for messages; files.c */ extern const struct symparse loadsyms[]; #if defined(TOS) extern boolean colors_changed; /* in tos.c */ diff --git a/src/pager.c b/src/pager.c index 2b2c051be..b3663aa3e 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1562,7 +1562,7 @@ add_quoted_engraving(coordxy x, coordxy y, char *buf) return TRUE; } -/* also used by getpos hack in do_name.c */ +/* also used by getpos hack in getpos.c */ const char what_is_an_unknown_object[] = "an unknown object"; int diff --git a/src/potion.c b/src/potion.c index f04da9595..cdc0287e3 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1455,9 +1455,9 @@ strange_feeling(struct obj *obj, const char *txt) useup(obj); } -const char *bottlenames[] = { "bottle", "phial", "flagon", "carafe", +static const char *bottlenames[] = { "bottle", "phial", "flagon", "carafe", "flask", "jar", "vial" }; -const char *hbottlenames[] = { +static const char *hbottlenames[] = { "jug", "pitcher", "barrel", "tin", "bag", "box", "glass", "beaker", "tumbler", "vase", "flowerpot", "pan", "thingy", "mug", "teacup", "teapot", "keg", "bucket", "thermos", "amphora", "wineskin", "parcel", diff --git a/src/shk.c b/src/shk.c index 086024113..b6e93c3f0 100644 --- a/src/shk.c +++ b/src/shk.c @@ -4923,7 +4923,7 @@ shk_embellish(struct obj *itm, long cost) DISABLE_WARNING_FORMAT_NONLITERAL /* First 4 supplied by Ronen and Tamar, remainder by development team */ -const char *Izchak_speaks[] = { +static const char *Izchak_speaks[] = { "%s says: 'These shopping malls give me a headache.'", "%s says: 'Slow down. Think clearly.'", "%s says: 'You need to take things one at a time.'", diff --git a/src/shknam.c b/src/shknam.c index 6a4833942..4775a1107 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -201,6 +201,7 @@ static const char *const shkhealthfoods[] = { * *_CLASS enum value) or a specific object enum value. * In the latter case, prepend it with a unary minus so the code can know * (by testing the sign) whether to use mkobj() or mksobj(). + * shtypes[] is externally referenced from mkroom.c, mon.c and shk.c. */ const struct shclass shtypes[] = { { "general store", diff --git a/src/sounds.c b/src/sounds.c index 5c34ffd97..d27e581f9 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1714,7 +1714,7 @@ extern struct sound_procs macsound_procs; extern struct sound_procs qtsound_procs; #endif -struct sound_procs nosound_procs = { +static struct sound_procs nosound_procs = { SOUNDID(nosound), 0L, (void (*)(void)) 0, /* init_nhsound */ diff --git a/src/symbols.c b/src/symbols.c index c11dfe81b..8172f73e2 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -373,6 +373,7 @@ symset_is_compatible( * particular types of symset "handling", define a * H_XXX macro in include/sym.h and add the name * to this array at the matching offset. + * Externally referenced from files.c, options.c, utf8map.c. */ const char *const known_handling[] = { "UNKNOWN", /* H_UNK */ diff --git a/src/topten.c b/src/topten.c index 2d608a8cb..b7feb33fa 100644 --- a/src/topten.c +++ b/src/topten.c @@ -52,7 +52,8 @@ struct toptenentry { char plalign[ROLESZ + 1]; char name[NAMSZ + 1]; char death[DTHSZ + 1]; -} *tt_head; +}; +static struct toptenentry *tt_head; /* size big enough to read in all the string fields at once; includes room for separating space or trailing newline plus string terminator */ #define SCANBUFSZ (4 * (ROLESZ + 1) + (NAMSZ + 1) + (DTHSZ + 1) + 1) diff --git a/src/utf8map.c b/src/utf8map.c index 1dcd8fc21..2c346550b 100644 --- a/src/utf8map.c +++ b/src/utf8map.c @@ -28,7 +28,7 @@ struct find_struct { enum reserved_activities restype; genericptr_t reserved; }; -const struct find_struct zero_find = { 0 }; +static const struct find_struct zero_find = { 0 }; struct glyphid_cache_t { int glyphnum; char *id; @@ -36,7 +36,7 @@ struct glyphid_cache_t { static struct glyphid_cache_t *glyphid_cache; static unsigned glyphid_cache_lsize; static size_t glyphid_cache_size; -struct find_struct glyphcache_find, to_custom_symbol_find; +static struct find_struct glyphcache_find, to_custom_symbol_find; static void init_glyph_cache(void); static void add_glyph_to_cache(int glyphnum, const char *id); static int find_glyph_in_cache(const char *id); diff --git a/src/vision.c b/src/vision.c index 64b1aaea1..921ccf23c 100644 --- a/src/vision.c +++ b/src/vision.c @@ -22,7 +22,8 @@ * ....X +4 * @...X +4 * - */ + * Externally referenced from light.c +*/ const coordxy circle_data[] = { /* 0*/ 0, /* 1*/ 1, 1, diff --git a/src/worn.c b/src/worn.c index be646bbdf..2ba028269 100644 --- a/src/worn.c +++ b/src/worn.c @@ -10,7 +10,7 @@ static void clear_bypass(struct obj *) NO_NNARGS; static void m_dowear_type(struct monst *, long, boolean, boolean) NONNULLARG1; static int extra_pref(struct monst *, struct obj *) NONNULLARG1; -const struct worn { +static const struct worn { long w_mask; struct obj **w_obj; const char *w_what; /* for failing sanity check's feedback */ diff --git a/src/zap.c b/src/zap.c index c2cdca866..bbe5e5c69 100644 --- a/src/zap.c +++ b/src/zap.c @@ -5589,6 +5589,7 @@ item_what(int dmgtyp) * [6] shocked wand * (books, rings, and wands don't stack so don't need plural form; * crumbling ring doesn't do damage so doesn't need killer reason) + * externally referenced from trap.c. */ const char *const destroy_strings[][3] = { /* also used in trap.c */ diff --git a/util/panic.c b/util/panic.c index d15bec88c..50fe43705 100644 --- a/util/panic.c +++ b/util/panic.c @@ -19,7 +19,7 @@ extern void vms_abort(void); #endif /*VARARGS1*/ -boolean panicking; +static boolean panicking; void panic(const char *, ...); DISABLE_WARNING_FORMAT_NONLITERAL