]> granicus.if.org Git - nethack/commitdiff
string constants
authornethack.allison <nethack.allison>
Tue, 20 Aug 2002 08:05:20 +0000 (08:05 +0000)
committernethack.allison <nethack.allison>
Tue, 20 Aug 2002 08:05:20 +0000 (08:05 +0000)
<Someone> wrote:
> Linux, Redhat 7.1 nethack 3.4.0
>
>Please see attached patch file.
>
>I'm attempting to move more stuff into the "read-only" area, in
>preparation for a port to another OS.

27 files changed:
include/decl.h
include/extern.h
include/mkroom.h
src/apply.c
src/artifact.c
src/attrib.c
src/botl.c
src/cmd.c
src/detect.c
src/dig.c
src/display.c
src/do.c
src/do_name.c
src/do_wear.c
src/drawing.c
src/shknam.c
src/sit.c
src/sounds.c
src/steal.c
src/timeout.c
src/topten.c
src/trap.c
src/u_init.c
src/version.c
src/weapon.c
src/wizard.c
src/zap.c

index a1e3cbc4085fbbb039b2fbb1c1dfb9d0d51a83f2..99627702770e7e645f9773392d298f34805e0b7f 100644 (file)
@@ -337,7 +337,7 @@ E struct tc_gbl_data {      /* also declared in tcap.h */
 #endif
 
 /* xxxexplain[] is in drawing.c */
-E const char *monexplain[], *invisexplain, *objexplain[], *oclass_names[];
+E const char * const monexplain[], invisexplain[], * const objexplain[], * const oclass_names[];
 
 /* Some systems want to use full pathnames for some subsets of file names,
  * rather than assuming that they're all in the current directory.  This
index 6ee6e5ce148e0445f3f5ed55c42270b15ac95ee5..0914ab464fa412a49efd63b40134f6d653250705 100644 (file)
@@ -2190,7 +2190,7 @@ E int FDECL(weapon_type, (struct obj *));
 E int NDECL(uwep_skill_type);
 E int FDECL(weapon_hit_bonus, (struct obj *));
 E int FDECL(weapon_dam_bonus, (struct obj *));
-E void FDECL(skill_init, (struct def_skill *));
+E void FDECL(skill_init, (const struct def_skill *));
 
 /* ### were.c ### */
 
index 72bd5042300e8a8c3dce3c4f46fa3860a164c1dd..b1363bd0865233279c3f69f2a58ddca00361af54 100644 (file)
@@ -31,7 +31,7 @@ struct shclass {
            int iprob;          /* probability of an item type */
            int itype;  /* item type: if >=0 a class, if < 0 a specific item */
        } iprobs[5];
-       const char **shknms;    /* list of shopkeeper names for this type */
+       const char * const *shknms;     /* list of shopkeeper names for this type */
 };
 
 extern NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2];
index e9ea15edb96e38b822b860c34de8b5ffa8d02d59..c432f24d81d868526ca432cb0a872f03559e1175 100644 (file)
@@ -46,7 +46,7 @@ STATIC_DCL void FDECL(add_class, (char *, CHAR_P));
 void FDECL( amii_speaker, ( struct obj *, char *, int ) );
 #endif
 
-static char no_elbow_room[] = "don't have enough elbow-room to maneuver.";
+static const char no_elbow_room[] = "don't have enough elbow-room to maneuver.";
 
 #ifdef TOURIST
 STATIC_OVL int
@@ -192,7 +192,7 @@ int rx, ry, *resp;
        return FALSE;
 }
 
-static char hollow_str[] = "a hollow sound.  This must be a secret %s!";
+static const char hollow_str[] = "a hollow sound.  This must be a secret %s!";
 
 /* Strictly speaking it makes no sense for usage of a stethoscope to
    not take any time; however, unless it did, the stethoscope would be
@@ -291,7 +291,7 @@ use_stethoscope(obj)
        return res;
 }
 
-static char whistle_str[] = "produce a %s whistling sound.";
+static const char whistle_str[] = "produce a %s whistling sound.";
 
 STATIC_OVL void
 use_whistle(obj)
@@ -617,7 +617,7 @@ struct obj *obj;
 
 #define WEAK   3       /* from eat.c */
 
-static char look_str[] = "look %s.";
+static const char look_str[] = "look %s.";
 
 STATIC_OVL int
 use_mirror(obj)
@@ -1839,7 +1839,7 @@ struct obj *tstone;
     const char *streak_color;
     char stonebuf[QBUFSZ];
     static const char scritch[] = "\"scritch, scritch\"";
-    static char allowall[3] = { COIN_CLASS, ALL_CLASSES, 0 };
+    static const char allowall[3] = { COIN_CLASS, ALL_CLASSES, 0 };
 #ifndef GOLDOBJ
     struct obj goldobj;
 #endif
@@ -2317,9 +2317,9 @@ struct obj *obj;
 
 
 static const char
-       *not_enough_room = "There's not enough room here to use that.",
-       *where_to_hit = "Where do you want to hit?",
-       *cant_see_spot = "won't hit anything if you can't see that spot.";
+       not_enough_room[] = "There's not enough room here to use that.",
+       where_to_hit[] = "Where do you want to hit?",
+       cant_see_spot[] = "won't hit anything if you can't see that spot.";
 
 /* Distance attacks by pole-weapons */
 STATIC_OVL int
index d93944ca3f4eda34ef0d7c6895336249cfc9f95b..da806018a060909e8117228140e4b91dca9c8bd2 100644 (file)
@@ -876,7 +876,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */
                }
 
                if (youdefend || mdef->mhp > 0) {  /* ??? -dkh- */
-                       static const char *mb_verb[4] =
+                       static const char * const mb_verb[4] =
                                {"probe", "stun", "scare", "purge"};
 
                        if (youattack || youdefend || vis) {
@@ -987,7 +987,7 @@ int dieroll; /* needed for Magicbane and vorpal blades */
                }
            } else if (otmp->oartifact == ART_VORPAL_BLADE &&
                        (dieroll == 1 || mdef->data == &mons[PM_JABBERWOCK])) {
-               static const char *behead_msg[2] = {
+               static const char * const behead_msg[2] = {
                     "%s beheads %s!",
                     "%s decapitates %s!"
                };
index 7719710fa0b48a8451a8695767eee7d4b54ca6ed..8e4ac530821ce04e1cf97c70854d0edfec0e2069 100644 (file)
 
        /* part of the output on gain or loss of attribute */
 static
-const char     *plusattr[] = {
+const char     * const plusattr[] = {
        "strong", "smart", "wise", "agile", "tough", "charismatic"
 },
-               *minusattr[] = {
+               * const minusattr[] = {
        "weak", "stupid", "foolish", "clumsy", "fragile", "repulsive"
 };
 
index 4934572f5c5684e1f80238696494e7aae7ed5d42..6534ad797f6c661f3bf05b39e0cb7cba919d3fe2 100644 (file)
@@ -7,7 +7,7 @@
 #ifdef OVL0
 extern const char *hu_stat[];  /* defined in eat.c */
 
-const char *enc_stat[] = {
+const char * const enc_stat[] = {
        "",
        "Burdened",
        "Stressed",
index d284d664ea7b3831c4d90b20dd85109d27572b71..411eb90f685dddafd9795f8d8840a3c30c49656e 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -736,13 +736,13 @@ wiz_show_wmodes()
 /* -enlightenment and conduct- */
 static winid en_win;
 static const char
-       *You_ = "You ",
-       *are  = "are ",  *were  = "were ",
-       *have = "have ", *had   = "had ",
-       *can  = "can ",  *could = "could ";
+       You_[] = "You ",
+       are[]  = "are ",  were[]  = "were ",
+       have[] = "have ", had[]   = "had ",
+       can[]  = "can ",  could[] = "could ";
 static const char
-       *have_been  = "have been ",
-       *have_never = "have never ", *never = "never ";
+       have_been[]  = "have been ",
+       have_never[] = "have never ", never[] = "never ";
 
 #define enl_msg(prefix,present,past,suffix) \
                        enlght_line(prefix, final ? past : present, suffix)
@@ -776,7 +776,7 @@ int final;  /* 0 => still in progress; 1 => over, survived; 2 => dead */
 
 #ifdef ELBERETH
        if (u.uevent.uhand_of_elbereth) {
-           static const char *hofe_titles[3] = {
+           static const char * const hofe_titles[3] = {
                                "the Hand of Elbereth",
                                "the Envoy of Balance",
                                "the Glory of Arioch"
@@ -1061,8 +1061,8 @@ minimal_enlightenment()
        menu_item *selected;
        anything any;
        char buf[BUFSZ], buf2[BUFSZ];
-       static char fmtstr[] = "%-15s: %-12s";
-       static char deity_fmtstr[] = "%-17s%s";
+       static const char fmtstr[] = "%-15s: %-12s";
+       static const char deity_fmtstr[] = "%-17s%s";
 
        any.a_void = 0;
        buf[0] = buf2[0] = '\0';
@@ -1482,9 +1482,9 @@ add_debug_extended_commands()
 }
 
 
-static const char *template = "%-18s %4ld  %6ld";
-static const char *count_str = "                   count  bytes";
-static const char *separator = "------------------ -----  ------";
+static const char template[] = "%-18s %4ld  %6ld";
+static const char count_str[] = "                   count  bytes";
+static const char separator[] = "------------------ -----  ------";
 
 STATIC_OVL void
 count_obj(chain, total_count, total_size, top, recurse)
index 799f3eb4d9bd9763e59a5d6089303117247defa8..325d8c59bb0ba09dc85f2e1b8ebb5484ace424e2 100644 (file)
@@ -753,7 +753,7 @@ d_level *where;
            else        return "near you";
 }
 
-static struct {
+static const struct {
     const char *what;
     d_level *where;
 } level_detects[] = {
index 980790f862457953f15601a4b58f0d904ad09f14..7016de891d2523fcbdb2d350d7206203470c62a6 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -410,7 +410,7 @@ cleanup:
                digging.level.dlevel = -1;
                return(0);
        } else {                /* not enough effort has been spent yet */
-               static const char *d_target[6] = {
+               static const char *const d_target[6] = {
                        "", "rock", "statue", "boulder", "door", "tree"
                };
                int dig_target = dig_typ(uwep, dpx, dpy);
@@ -923,7 +923,7 @@ struct obj *obj;
                            You("swing your %s through thin air.",
                                aobjnam(obj, (char *)0));
                } else {
-                       static const char *d_action[6] = {
+                       static const char * const d_action[6] = {
                                                "swinging",
                                                "digging",
                                                "chipping the statue",
index ae48324bbf393592ffdf406e6e65ab299c4831a3..6f0811db5279caba391b7e46483dc0731001bb1d 100644 (file)
@@ -1857,7 +1857,7 @@ STATIC_OVL void
 t_warn(lev)
     struct rm *lev;
 {
-    static const char *warn_str = "wall_angle: %s: case %d: seenv = 0x%x";
+    static const char warn_str[] = "wall_angle: %s: case %d: seenv = 0x%x";
     const char *wname;
 
     if (lev->typ == TUWALL) wname = "tuwall";
index e876a21cb0be55b1fd4fd45d710565cb369035e2..9d5f067c1263889bd61e84bfaf9d631e6baf4bec 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1233,13 +1233,13 @@ boolean at_stairs, falling, portal;
        }
 
        if (familiar) {
-           static const char *fam_msgs[4] = {
+           static const char * const fam_msgs[4] = {
                "You have a sense of deja vu.",
                "You feel like you've been here before.",
                "This place %s familiar...",
                0       /* no message */
            };
-           static const char *halu_fam_msgs[4] = {
+           static const char * const halu_fam_msgs[4] = {
                "Whoa!  Everything %s different.",
                "You are surrounded by twisty little passages, all alike.",
                "Gee, this %s like uncle Conan's place...",
index 32b7eaac73ec3b98a2814668312ca3e204a83eb7..a833b6ae5e02f6ad8cf450b0ecc985f898ac05a9 100644 (file)
@@ -49,7 +49,7 @@ const char *goal;
     int cx, cy, i, c;
     int sidx, tx, ty;
     boolean msg_given = TRUE;  /* clear message window by default */
-    static const char *pick_chars = ".,;:";
+    static const char pick_chars[] = ".,;:";
     const char *cp;
     const char *sdp;
     if(iflags.num_pad) sdp = ndir; else sdp = sdir;    /* DICE workaround */
@@ -525,7 +525,7 @@ register struct obj *obj;
 #endif /*OVLB*/
 #ifdef OVL0
 
-static const char *ghostnames[] = {
+static const char * const ghostnames[] = {
        /* these names should have length < PL_NSIZ */
        /* Capitalize the names for aesthetics -dgk */
        "Adri", "Andries", "Andreas", "Bert", "David", "Dirk", "Emile",
@@ -871,7 +871,7 @@ char *outbuf;
     return outbuf;
 }
 
-static const char *bogusmons[] = {
+static const char * const bogusmons[] = {
        "jumbo shrimp", "giant pigmy", "gnu", "killer penguin",
        "giant cockroach", "giant slug", "maggot", "pterodactyl",
        "tyrannosaurus rex", "basilisk", "beholder", "nightmare",
@@ -968,7 +968,7 @@ roguename() /* Name of a Rogue player */
 
 #ifdef OVL2
 
-static NEARDATA const char *hcolors[] = {
+static NEARDATA const char * const hcolors[] = {
        "ultraviolet", "infrared", "bluish-orange",
        "reddish-green", "dark white", "light black", "sky blue-pink",
        "salty", "sweet", "sour", "bitter",
@@ -991,7 +991,7 @@ const char *colorpref;
 /* Aliases for road-runner nemesis
  * See also http://www.geocities.com/EnchantedForest/1141/latin.html
  */
-static const char *coynames[] = {
+static const char * const coynames[] = {
        "Carnivorous Vulgaris","Road-Runnerus Digestus",
        "Eatibus Anythingus"  ,"Famishus-Famishus",
        "Eatibus Almost Anythingus","Eatius Birdius",
index cc79dad4f1e256d2359513663632395220d08cc9..4129816a7683763c6e38e6ffe5f13afb2420e425 100644 (file)
@@ -17,20 +17,20 @@ static boolean cancelled_don = FALSE;
 
 static NEARDATA const char see_yourself[] = "see yourself";
 static NEARDATA const char unknown_type[] = "Unknown type of %s (%d)";
-static NEARDATA const char *c_armor  = "armor",
-                          *c_suit   = "suit",
+static NEARDATA const char c_armor[]  = "armor",
+                          c_suit[]   = "suit",
 #ifdef TOURIST
-                          *c_shirt  = "shirt",
+                          c_shirt[]  = "shirt",
 #endif
-                          *c_cloak  = "cloak",
-                          *c_gloves = "gloves",
-                          *c_boots  = "boots",
-                          *c_helmet = "helmet",
-                          *c_shield = "shield",
-                          *c_weapon = "weapon",
-                          *c_sword  = "sword",
-                          *c_axe    = "axe",
-                          *c_that_  = "that";
+                          c_cloak[]  = "cloak",
+                          c_gloves[] = "gloves",
+                          c_boots[]  = "boots",
+                          c_helmet[] = "helmet",
+                          c_shield[] = "shield",
+                          c_weapon[] = "weapon",
+                          c_sword[]  = "sword",
+                          c_axe[]    = "axe",
+                          c_that_[]  = "that";
 
 static NEARDATA const long takeoff_order[] = { WORN_BLINDF, W_WEP,
        WORN_SHIELD, WORN_GLOVES, LEFT_RING, RIGHT_RING, WORN_CLOAK,
index 62054ea77dbb77ffb5cddc596cbe8b6eb9cef132..da6e95abeef2db07b0ea997c5eaa66a2e2dc74e8 100644 (file)
@@ -46,10 +46,10 @@ const char def_oc_syms[MAXOCLASSES] = {
        VENOM_SYM
 };
 
-const char *invisexplain = "remembered, unseen, creature";
+const char invisexplain[] = "remembered, unseen, creature";
 
 /* Object descriptions.  Used in do_look(). */
-const char *objexplain[] = {   /* these match def_oc_syms, above */
+const char * const objexplain[] = {    /* these match def_oc_syms, above */
 /* 0*/ 0,
        "strange object",
        "weapon",
@@ -71,7 +71,7 @@ const char *objexplain[] = {  /* these match def_oc_syms, above */
 };
 
 /* Object class names.  Used in object_detect(). */
-const char *oclass_names[] = {
+const char * const oclass_names[] = {
 /* 0*/ 0,
        "illegal objects",
        "weapons",
@@ -161,7 +161,7 @@ const char def_monsyms[MAXMCLASSES] = {
  * for blessed genocide, so no text should wholly contain any later
  * text.  They should also always contain obvious names (eg. cat/feline).
  */
-const char *monexplain[MAXMCLASSES] = {
+const char * const monexplain[MAXMCLASSES] = {
     0,
     "ant or other insect",     "blob",                 "cockatrice",
     "dog or other canine",     "eye or sphere",        "cat or other feline",
index 76fd007d89c3c81ddda88585a69f49a9b0e0a9de..9c2e8c2a5ba0cc054adf1b89572c87758cf5e352 100644 (file)
@@ -13,10 +13,10 @@ extern const struct shclass shtypes[];
 #else
 
 STATIC_DCL void FDECL(mkshobj_at, (const struct shclass *,int,int));
-STATIC_DCL void FDECL(nameshk, (struct monst *,const char **));
+STATIC_DCL void FDECL(nameshk, (struct monst *,const char * const *));
 STATIC_DCL int  FDECL(shkinit, (const struct shclass *,struct mkroom *));
 
-static const char *shkliquors[] = {
+static const char * const shkliquors[] = {
     /* Ukraine */
     "Njezjin", "Tsjernigof", "Gomel", "Ossipewsk", "Gorlowka",
     /* N. Russia */
@@ -31,7 +31,7 @@ static const char *shkliquors[] = {
     0
 };
 
-static const char *shkbooks[] = {
+static const char * const shkbooks[] = {
     /* Eire */
     "Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch",
     "Kinnegad", "Lugnaquillia", "Enniscorthy", "Gweebarra",
@@ -42,7 +42,7 @@ static const char *shkbooks[] = {
     0
 };
 
-static const char *shkarmors[] = {
+static const char * const shkarmors[] = {
     /* Turquie */
     "Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep",
     "Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak",
@@ -53,7 +53,7 @@ static const char *shkarmors[] = {
     0
 };
 
-static const char *shkwands[] = {
+static const char * const shkwands[] = {
     /* Wales */
     "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach",
     "Rhaeader", "Llandrindod", "Llanfair-ym-muallt",
@@ -67,7 +67,7 @@ static const char *shkwands[] = {
     0
 };
 
-static const char *shkrings[] = {
+static const char * const shkrings[] = {
     /* Hollandse familienamen */
     "Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken",
     "Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy",
@@ -80,7 +80,7 @@ static const char *shkrings[] = {
     0
 };
 
-static const char *shkfoods[] = {
+static const char * const shkfoods[] = {
     /* Indonesia */
     "Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan",
     "Bandjar", "Parbalingga", "Bojolali", "Sarangan",
@@ -92,7 +92,7 @@ static const char *shkfoods[] = {
     0
 };
 
-static const char *shkweapons[] = {
+static const char * const shkweapons[] = {
     /* Perigord */
     "Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard",
     "Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac",
@@ -103,7 +103,7 @@ static const char *shkweapons[] = {
     0
 };
 
-static const char *shktools[] = {
+static const char * const shktools[] = {
     /* Spmi */
     "Ymla", "Eed-morra", "Cubask", "Nieb", "Bnowr Falr", "Telloc Cyaj",
     "Sperc", "Noskcirdneh", "Yawolloh", "Hyeghu", "Niskal", "Trahnil",
@@ -134,7 +134,7 @@ static const char *shktools[] = {
     0
 };
 
-static const char *shklight[] = {
+static const char * const shklight[] = {
     /* Romania */
     "Zarnesti", "Slanic", "Nehoiasu", "Ludus", "Sighisoara", "Nisipitu",
     "Razboieni", "Bicaz", "Dorohoi", "Vaslui", "Fetesti", "Tirgu Neamt",
@@ -146,7 +146,7 @@ static const char *shklight[] = {
     0
 };
 
-static const char *shkgeneral[] = {
+static const char * const shkgeneral[] = {
     /* Suriname */
     "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi",
     "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo",
@@ -271,7 +271,7 @@ int sx, sy;
 STATIC_OVL void
 nameshk(shk, nlp)
 struct monst *shk;
-const char *nlp[];
+const char * const nlp[];
 {
        int i, trycnt, names_avail;
        const char *shname = 0;
index 9e2eb0b75255b1be89a6c49afa64257c2ea920c9..75b8ad5d9abc6a51cca9b7328ed544a9ee8e21ab 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -37,7 +37,7 @@ take_gold()
 int
 dosit()
 {
-       static const char *sit_message = "sit on the %s.";
+       static const char sit_message[] = "sit on the %s.";
        register struct trap *trap;
        register int typ = levl[u.ux][u.uy].typ;
 
@@ -312,7 +312,7 @@ rndcurse()                  /* curse a few inventory items at random! */
        int     nobj = 0;
        int     cnt, onum;
        struct  obj     *otmp;
-       static const char *mal_aura = "feel a malignant aura surround %s.";
+       static const char mal_aura[] = "feel a malignant aura surround %s.";
 
        if (uwep && (uwep->oartifact == ART_MAGICBANE) && rn2(20)) {
            You(mal_aura, "the magic-absorbing blade");
index 32f83c9ce01c722f27825809d31da31e51f57ec3..fad33099bf31556822505067ec260e1b50a2a53c 100644 (file)
@@ -45,7 +45,7 @@ dosounds()
     hallu = Hallucination ? 1 : 0;
 
     if (level.flags.nfountains && !rn2(400)) {
-       static const char *fountain_msg[4] = {
+       static const char * const fountain_msg[4] = {
                "bubbling water.",
                "water falling on coins.",
                "the splashing of a naiad.",
@@ -55,7 +55,7 @@ dosounds()
     }
 #ifdef SINK
     if (level.flags.nsinks && !rn2(300)) {
-       static const char *sink_msg[3] = {
+       static const char * const sink_msg[3] = {
                "a slow drip.",
                "a gurgling noise.",
                "dishes being washed!",
@@ -64,7 +64,7 @@ dosounds()
     }
 #endif
     if (level.flags.has_court && !rn2(200)) {
-       static const char *throne_msg[4] = {
+       static const char * const throne_msg[4] = {
                "the tones of courtly conversation.",
                "a sceptre pounded in judgment.",
                "Someone shouts \"Off with %s head!\"",
@@ -86,7 +86,7 @@ dosounds()
        }
     }
     if (level.flags.has_swamp && !rn2(200)) {
-       static const char *swamp_msg[3] = {
+       static const char * const swamp_msg[3] = {
                "hear mosquitoes!",
                "smell marsh gas!",     /* so it's a smell...*/
                "hear Donald Duck!",
@@ -181,7 +181,7 @@ dosounds()
        }
     }
     if (level.flags.has_barracks && !rn2(200)) {
-       static const char *barracks_msg[4] = {
+       static const char * const barracks_msg[4] = {
                "blades being honed.",
                "loud snoring.",
                "dice being thrown.",
@@ -205,7 +205,7 @@ dosounds()
        }
     }
     if (level.flags.has_zoo && !rn2(200)) {
-       static const char *zoo_msg[3] = {
+       static const char * const zoo_msg[3] = {
                "a sound reminiscent of an elephant stepping on a peanut.",
                "a sound reminiscent of a seal barking.",
                "Doctor Doolittle!",
@@ -227,7 +227,7 @@ dosounds()
        }
        if (tended_shop(sroom) &&
                !index(u.ushops, ROOM_INDEX(sroom) + ROOMOFFSET)) {
-           static const char *shop_msg[3] = {
+           static const char * const shop_msg[3] = {
                    "someone cursing shoplifters.",
                    "the chime of a cash register.",
                    "Neiman and Marcus arguing!",
@@ -243,7 +243,7 @@ dosounds()
                break;
        /* and don't produce silly effects when she's clearly visible */
        if (mtmp && (hallu || !canseemon(mtmp))) {
-           static const char *ora_msg[5] = {
+           static const char * const ora_msg[5] = {
                    "a strange wind.",          /* Jupiter at Dodona */
                    "convulsive ravings.",      /* Apollo at Delphi */
                    "snoring snakes.",          /* AEsculapius at Epidaurus */
@@ -259,7 +259,7 @@ dosounds()
 #endif /* OVL0 */
 #ifdef OVLB
 
-static const char *h_sounds[] = {
+static const char * const h_sounds[] = {
     "beep", "boing", "sing", "belche", "creak", "cough", "rattle",
     "ululate", "pop", "jingle", "sniffle", "tinkle", "eep"
 };
@@ -495,7 +495,7 @@ register struct monst *mtmp;
                                verbl_msg = "I only drink... potions.";
                } else {
                        int vampindex;
-                       static const char *vampmsg[] = {
+                       static const char * const vampmsg[] = {
                               /* These first two (0 and 1) are specially handled below */
                                "I vant to suck your %s!",
                                "I vill come after %s without regret!",
@@ -623,7 +623,7 @@ register struct monst *mtmp;
            break;
        case MS_LAUGH:
            {
-               static const char *laugh_msg[4] = {
+               static const char * const laugh_msg[4] = {
                    "giggles.", "chuckles.", "snickers.", "laughs.",
                };
                pline_msg = laugh_msg[rn2(4)];
@@ -739,7 +739,7 @@ register struct monst *mtmp;
                verbalize("Just the facts, %s.",
                      flags.female ? "Ma'am" : "Sir");
            else {
-               static const char *arrest_msg[3] = {
+               static const char * const arrest_msg[3] = {
                    "Anything you say can be used against you.",
                    "You're under arrest!",
                    "Stop in the name of the Law!",
@@ -787,11 +787,11 @@ register struct monst *mtmp;
            break;
        case MS_SOLDIER:
            {
-               static const char *soldier_foe_msg[3] = {
+               static const char * const soldier_foe_msg[3] = {
                    "Resistance is useless!",
                    "You're dog meat!",
                    "Surrender!",
-               },                *soldier_pax_msg[3] = {
+               },                * const soldier_pax_msg[3] = {
                    "What lousy pay we're getting here!",
                    "The food's not fit for Orcs!",
                    "My feet hurt, I've been on them all day!",
index 7d11a8a3f9d8a0361be602172d986d50be8b668d..922ca609424984c7d0a52f7520b96a36a018ab31 100644 (file)
@@ -313,7 +313,7 @@ gotobj:
                ostuck = (otmp->cursed && otmp->owornmask);
 
            if (ostuck || !can_carry(mtmp, otmp)) {
-               static const char *how[] = { "steal","snatch","grab","take" };
+               static const char * const how[] = { "steal","snatch","grab","take" };
  cant_take:
                pline("%s tries to %s your %s but gives up.",
                      Monnam(mtmp), how[rn2(SIZE(how))],
index 0f0dcbbee774d2cc5ec8b438da9aa76b9b6c9d81..f23e5900ff52e0818b6e5e3d0950187234e60908 100644 (file)
@@ -17,7 +17,7 @@ STATIC_DCL void FDECL(cleanup_burn, (genericptr_t,long));
 #ifdef OVLB
 
 /* He is being petrified - dialogue by inmet!tower */
-static NEARDATA const char *stoned_texts[] = {
+static NEARDATA const char * const stoned_texts[] = {
        "You are slowing down.",                /* 5 */
        "Your limbs are stiffening.",           /* 4 */
        "Your limbs have turned to stone.",     /* 3 */
@@ -40,7 +40,7 @@ stoned_dialogue()
 }
 
 /* He is getting sicker and sicker prior to vomiting */
-static NEARDATA const char *vomiting_texts[] = {
+static NEARDATA const char * const vomiting_texts[] = {
        "are feeling mildly nauseous.",         /* 14 */
        "feel slightly confused.",              /* 11 */
        "can't seem to think straight.",        /* 8 */
@@ -72,7 +72,7 @@ vomiting_dialogue()
        exercise(A_CON, FALSE);
 }
 
-static NEARDATA const char *choke_texts[] = {
+static NEARDATA const char * const choke_texts[] = {
        "You find it hard to breathe.",
        "You're gasping for air.",
        "You can no longer breathe.",
@@ -80,7 +80,7 @@ static NEARDATA const char *choke_texts[] = {
        "You suffocate."
 };
 
-static NEARDATA const char *choke_texts2[] = {
+static NEARDATA const char * const choke_texts2[] = {
        "Your %s is becoming constricted.",
        "Your blood is having trouble reaching your brain.",
        "The pressure on your %s increases.",
@@ -108,7 +108,7 @@ choke_dialogue()
        exercise(A_STR, FALSE);
 }
 
-static NEARDATA const char *slime_texts[] = {
+static NEARDATA const char * const slime_texts[] = {
        "You are turning a little %s.",           /* 5 */
        "Your limbs are getting oozy.",              /* 4 */
        "Your skin begins to peel away.",            /* 3 */
@@ -1309,7 +1309,7 @@ typedef struct {
 } ttable;
 
 /* table of timeout functions */
-static ttable timeout_funcs[NUM_TIME_FUNCS] = {
+static const ttable timeout_funcs[NUM_TIME_FUNCS] = {
     TTAB(rot_organic,  (timeout_proc)0,        "rot_organic"),
     TTAB(rot_corpse,   (timeout_proc)0,        "rot_corpse"),
     TTAB(revive_mon,   (timeout_proc)0,        "revive_mon"),
index 0191997e5bcb7a2f14775b920c718264257e4d09..08f80e96c24144d1ca76cfd7cae2b4aa4fbb60c9 100644 (file)
@@ -76,7 +76,7 @@ STATIC_DCL void FDECL(nsb_unmung_line,(char*));
 #endif
 
 /* must fit with end.c; used in rip.c */
-NEARDATA const char *killed_by_prefix[] = {
+NEARDATA const char * const killed_by_prefix[] = {
        "killed by ", "choked on ", "poisoned by ", "", "drowned in ",
        "burned by ", "dissolved in ", "crushed to death by ", "petrified by ",
        "turned to slime by ", "killed by ", "", "", "", "", ""
@@ -128,13 +128,13 @@ FILE *rfile;
 struct toptenentry *tt;
 {
 #ifdef NO_SCAN_BRACK /* Version_ Pts DgnLevs_ Hp___ Died__Born id */
-       static const char *fmt = "%d %d %d %ld %d %d %d %d %d %d %ld %ld %d%*c";
-       static const char *fmt32 = "%c%c %s %s%*c";
-       static const char *fmt33 = "%s %s %s %s %s %s%*c";
+       static const char fmt[] = "%d %d %d %ld %d %d %d %d %d %d %ld %ld %d%*c";
+       static const char fmt32[] = "%c%c %s %s%*c";
+       static const char fmt33[] = "%s %s %s %s %s %s%*c";
 #else
-       static const char *fmt = "%d.%d.%d %ld %d %d %d %d %d %d %ld %ld %d ";
-       static const char *fmt32 = "%c%c %[^,],%[^\n]%*c";
-       static const char *fmt33 = "%s %s %s %s %[^,],%[^\n]%*c";
+       static const char fmt[] = "%d.%d.%d %ld %d %d %d %d %d %d %ld %ld %d ";
+       static const char fmt32[] = "%c%c %[^,],%[^\n]%*c";
+       static const char fmt33[] = "%s %s %s %s %[^,],%[^\n]%*c";
 #endif
 
 #ifdef UPDATE_RECORD_IN_PLACE
index 526e7bd687f9523648c68a3fbe1f06c491e0513c..f26a300da7ce89907ab2dca6fbaa3cd425b2249b 100644 (file)
@@ -38,11 +38,11 @@ STATIC_VAR const char * const blindgas[6];
 
 #else
 
-STATIC_VAR const char *a_your[2] = { "a", "your" };
-STATIC_VAR const char *A_Your[2] = { "A", "Your" };
-STATIC_VAR const char *the_your[2] = { "the", "your" };
+STATIC_VAR const char * const a_your[2] = { "a", "your" };
+STATIC_VAR const char * const A_Your[2] = { "A", "Your" };
+STATIC_VAR const char * const the_your[2] = { "the", "your" };
 STATIC_VAR const char tower_of_flame[] = "tower of flame";
-STATIC_VAR const char *A_gush_of_water_hits = "A gush of water hits";
+STATIC_VAR const char * const A_gush_of_water_hits = "A gush of water hits";
 STATIC_VAR const char * const blindgas[6] = 
        {"humid", "odorless", "pungent", "chilling", "acrid", "biting"};
 
@@ -120,8 +120,8 @@ int type;
 boolean print;
 struct monst *victim;
 {
-       static NEARDATA const char *action[] = { "smoulder", "rust", "rot", "corrode" };
-       static NEARDATA const char *msg[] =  { "burnt", "rusted", "rotten", "corroded" };
+       static NEARDATA const char * const action[] = { "smoulder", "rust", "rot", "corrode" };
+       static NEARDATA const char * const msg[] =  { "burnt", "rusted", "rotten", "corroded" };
        boolean vulnerable = FALSE;
        boolean grprot = FALSE;
        boolean is_primary = TRUE;
@@ -3668,7 +3668,7 @@ unconscious()
                !strncmp(nomovemsg,"You are consci", 14))));
 }
 
-static char lava_killer[] = "molten lava";
+static const char lava_killer[] = "molten lava";
 
 boolean
 lava_effects()
index da6839a628ee138a0afcbd81467e3e229153bee0..2a371916a0841cb71e154fd50295ef35027179bd 100644 (file)
@@ -251,7 +251,7 @@ static struct inv_sub { short race_pm, item_otyp, subs_otyp; } inv_subs[] = {
     { NON_PM,  STRANGE_OBJECT,         STRANGE_OBJECT        }
 };
 
-static struct def_skill Skill_A[] = {
+static const struct def_skill Skill_A[] = {
     { P_DAGGER, P_BASIC },             { P_KNIFE,  P_BASIC },
     { P_PICK_AXE, P_EXPERT },          { P_SHORT_SWORD, P_BASIC },
     { P_SCIMITAR, P_SKILLED },         { P_SABER, P_EXPERT },
@@ -269,7 +269,7 @@ static struct def_skill Skill_A[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_B[] = {
+static const struct def_skill Skill_B[] = {
     { P_DAGGER, P_BASIC },             { P_AXE, P_EXPERT },
     { P_PICK_AXE, P_EXPERT },          { P_SHORT_SWORD, P_BASIC },
     { P_BROAD_SWORD, P_SKILLED },      { P_LONG_SWORD, P_SKILLED },
@@ -288,7 +288,7 @@ static struct def_skill Skill_B[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_C[] = {
+static const struct def_skill Skill_C[] = {
     { P_DAGGER, P_BASIC },             { P_KNIFE,  P_SKILLED },
     { P_AXE, P_SKILLED },              { P_PICK_AXE, P_BASIC },
     { P_CLUB, P_EXPERT },              { P_MACE, P_EXPERT },
@@ -303,7 +303,7 @@ static struct def_skill Skill_C[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_H[] = {
+static const struct def_skill Skill_H[] = {
     { P_DAGGER, P_SKILLED },           { P_KNIFE, P_EXPERT },
     { P_SHORT_SWORD, P_SKILLED },      { P_SCIMITAR, P_BASIC },
     { P_SABER, P_BASIC },              { P_CLUB, P_SKILLED },
@@ -317,7 +317,7 @@ static struct def_skill Skill_H[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_K[] = {
+static const struct def_skill Skill_K[] = {
     { P_DAGGER, P_BASIC },             { P_KNIFE, P_BASIC },
     { P_AXE, P_SKILLED },              { P_PICK_AXE, P_BASIC },
     { P_SHORT_SWORD, P_SKILLED },      { P_BROAD_SWORD, P_SKILLED },
@@ -339,7 +339,7 @@ static struct def_skill Skill_K[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_Mon[] = {
+static const struct def_skill Skill_Mon[] = {
     { P_QUARTERSTAFF, P_BASIC },    { P_SPEAR, P_BASIC },
     { P_JAVELIN, P_BASIC },                { P_CROSSBOW, P_BASIC },
     { P_SHURIKEN, P_BASIC },
@@ -351,7 +351,7 @@ static struct def_skill Skill_Mon[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_P[] = {
+static const struct def_skill Skill_P[] = {
     { P_CLUB, P_EXPERT },              { P_MACE, P_EXPERT },
     { P_MORNING_STAR, P_EXPERT },      { P_FLAIL, P_EXPERT },
     { P_HAMMER, P_EXPERT },            { P_QUARTERSTAFF, P_EXPERT },
@@ -367,7 +367,7 @@ static struct def_skill Skill_P[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_R[] = {
+static const struct def_skill Skill_R[] = {
     { P_DAGGER, P_EXPERT },            { P_KNIFE,  P_EXPERT },
     { P_SHORT_SWORD, P_EXPERT },       { P_BROAD_SWORD, P_SKILLED },
     { P_LONG_SWORD, P_SKILLED },       { P_TWO_HANDED_SWORD, P_BASIC },
@@ -387,7 +387,7 @@ static struct def_skill Skill_R[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_Ran[] = {
+static const struct def_skill Skill_Ran[] = {
     { P_DAGGER, P_EXPERT },             { P_KNIFE,  P_SKILLED },
     { P_AXE, P_SKILLED },       { P_PICK_AXE, P_BASIC },
     { P_SHORT_SWORD, P_BASIC },         { P_MORNING_STAR, P_BASIC },
@@ -408,7 +408,7 @@ static struct def_skill Skill_Ran[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_S[] = {
+static const struct def_skill Skill_S[] = {
     { P_DAGGER, P_BASIC },             { P_KNIFE,  P_SKILLED },
     { P_SHORT_SWORD, P_EXPERT },       { P_BROAD_SWORD, P_SKILLED },
     { P_LONG_SWORD, P_EXPERT },                { P_TWO_HANDED_SWORD, P_EXPERT },
@@ -427,7 +427,7 @@ static struct def_skill Skill_S[] = {
 };
 
 #ifdef TOURIST
-static struct def_skill Skill_T[] = {
+static const struct def_skill Skill_T[] = {
     { P_DAGGER, P_EXPERT },            { P_KNIFE,  P_SKILLED },
     { P_AXE, P_BASIC },                        { P_PICK_AXE, P_BASIC },
     { P_SHORT_SWORD, P_EXPERT },       { P_BROAD_SWORD, P_BASIC },
@@ -453,7 +453,7 @@ static struct def_skill Skill_T[] = {
 };
 #endif /* TOURIST */
 
-static struct def_skill Skill_V[] = {
+static const struct def_skill Skill_V[] = {
     { P_DAGGER, P_EXPERT },            { P_AXE, P_EXPERT },
     { P_PICK_AXE, P_SKILLED },         { P_SHORT_SWORD, P_SKILLED },
     { P_BROAD_SWORD, P_SKILLED },      { P_LONG_SWORD, P_EXPERT },
@@ -472,7 +472,7 @@ static struct def_skill Skill_V[] = {
     { P_NONE, 0 }
 };
 
-static struct def_skill Skill_W[] = {
+static const struct def_skill Skill_W[] = {
     { P_DAGGER, P_EXPERT },            { P_KNIFE,  P_SKILLED },
     { P_AXE, P_SKILLED },              { P_SHORT_SWORD, P_BASIC },
     { P_CLUB, P_SKILLED },             { P_MACE, P_BASIC },
@@ -850,7 +850,7 @@ STATIC_OVL boolean
 restricted_spell_discipline(otyp)
 int otyp;
 {
-    struct def_skill *skills;
+    const struct def_skill *skills;
     int this_skill = spell_skilltype(otyp);
 
     switch (Role_switch) {
index 669d22d9c90cbec2a8bd5b14fd88c3a7974368ac..3b0c8077bca27196cdab93b282376a5237e11800 100644 (file)
@@ -112,7 +112,7 @@ void
 store_version(fd)
 int fd;
 {
-       static struct version_info version_data = {
+       const static struct version_info version_data = {
                        VERSION_NUMBER, VERSION_FEATURES,
                        VERSION_SANITY1, VERSION_SANITY2
        };
index 638146bd6e54a3b2a405abc5a2ba4f0f29c5bd23..9089f798362533777fb1d752ce04507fd70ccff1 100644 (file)
@@ -56,7 +56,7 @@ STATIC_VAR NEARDATA const short skill_names_indices[P_NUM_SKILLS] = {
 };
 
 /* note: entry [0] isn't used */
-STATIC_VAR NEARDATA const char *odd_skill_names[] = {
+STATIC_VAR NEARDATA const char * const odd_skill_names[] = {
     "no skill",
     "bare hands",              /* use barehands_or_martial[] instead */
     "two weapon combat",
@@ -74,7 +74,7 @@ STATIC_VAR NEARDATA const char *odd_skill_names[] = {
     "matter spells",
 };
 /* indexed vis `is_martial() */
-STATIC_VAR NEARDATA const char *barehands_or_martial[] = {
+STATIC_VAR NEARDATA const char * const barehands_or_martial[] = {
     "bare handed combat", "martial arts"
 };
 
@@ -472,7 +472,7 @@ register struct monst *mtmp;
 }
 
 /* Weapons in order of preference */
-static NEARDATA short hwep[] = {
+static const NEARDATA short hwep[] = {
          CORPSE,  /* cockatrice corpse */
          TSURUGI, RUNESWORD, DWARVISH_MATTOCK, TWO_HANDED_SWORD, BATTLE_AXE,
          KATANA, UNICORN_HORN, CRYSKNIFE, TRIDENT, LONG_SWORD,
@@ -835,7 +835,7 @@ int skill;
        P_NAME(skill));
 }
 
-static struct skill_range {
+const static struct skill_range {
        short first, last;
        const char *name;
 } skill_ranges[] = {
@@ -1237,7 +1237,7 @@ struct obj *weapon;
  */
 void
 skill_init(class_skill)
-struct def_skill *class_skill;
+const struct def_skill *class_skill;
 {
        struct obj *obj;
        int skmax, skill;
index e357234155211cb53a47185d196ac51a182ba311..e6dbca12f4f76789776bf8552b3afa737543cb01 100644 (file)
@@ -550,7 +550,7 @@ wizdead()
        }
 }
 
-const char *random_insult[] = {
+const char * const random_insult[] = {
        "antic",
        "blackguard",
        "caitiff",
@@ -581,7 +581,7 @@ const char *random_insult[] = {
        "wretch",
 };
 
-const char *random_malediction[] = {
+const char * const random_malediction[] = {
        "Hell shall soon claim thy remains,",
        "I chortle at thee, thou pathetic",
        "Prepare to die, thou",
index 56cc896cdf4118289f2afb2b1682c4144fff35e0..cabaf61c9ba98947d04793f5972620877d70beab 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -62,7 +62,7 @@ extern const char *flash_types[];
 #else
 STATIC_VAR const char are_blinded_by_the_flash[] = "are blinded by the flash!";
 
-const char *flash_types[] = {          /* also used in buzzmu(mcastu.c) */
+const char * const flash_types[] = {           /* also used in buzzmu(mcastu.c) */
        "magic missile",        /* Wands must be 0-9 */
        "bolt of fire",
        "bolt of cold",
@@ -3752,7 +3752,7 @@ register struct obj *obj;
        return TRUE;
 }
 
-const char *destroy_strings[] = {
+const char * const destroy_strings[] = {
        "freezes and shatters", "freeze and shatter", "shattered potion",
        "boils and explodes", "boil and explode", "boiling potion",
        "catches fire and burns", "catch fire and burn", "burning scroll",