]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0298: Some internal variables are not modified v9.2.0298
authorHirohito Higashi <h.east.727@gmail.com>
Sat, 4 Apr 2026 09:09:13 +0000 (09:09 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 4 Apr 2026 09:09:13 +0000 (09:09 +0000)
Problem:  Some internal variables are not modified
Solution: Add const qualifier to static table data
          (Hirohito Higashi).

Several static arrays that are never modified at runtime were missing the
const qualifier. Add const to move them from .data to .rodata section.

closes: #19901

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/crypt.c
src/ex_docmd.c
src/hardcopy.c
src/memline.c
src/pty.c
src/regexp.c
src/regexp_bt.c
src/regexp_nfa.c
src/term.c
src/version.c

index 794594f91042a52cbd087fa4cb3d20dc40e1beea..2fade5db9d6cf5ae1db1621feef452ca67d244d7 100644 (file)
@@ -342,7 +342,7 @@ sodium_enabled(int verbose)
 #endif
 
 #define CRYPT_MAGIC_LEN        12      // cannot change
-static char    crypt_magic_head[] = "VimCrypt~";
+static const char crypt_magic_head[] = "VimCrypt~";
 
 /*
  * Return int value for crypt method name.
index 7dfc1d56c9679af3bfb34ffdbfd1c41d096b0033..7834f2bdbd4fd80e2877b223011a088183147bf4 100644 (file)
@@ -2734,7 +2734,7 @@ ex_errmsg(char *msg, char_u *arg)
  * The "+" string used in place of an empty command in Ex mode.
  * This string is used in pointer comparison.
  */
-static char exmode_plus[] = "+";
+static const char exmode_plus[] = "+";
 
 /*
  * Handle a range without a command.
index 5333116049557fbbc64067ded4d86880052984d2..55d43841820594f842ac65368f8a44246743493c 100644 (file)
@@ -1394,7 +1394,7 @@ static int prt_use_courier;
 static int prt_in_ascii;
 static int prt_half_width;
 static char *prt_ascii_encoding;
-static char_u prt_hexchar[] = "0123456789abcdef";
+static const char_u prt_hexchar[] = "0123456789abcdef";
 
     static void
 prt_write_file_raw_len(char_u *buffer, int bytes)
index 35b1fae2301737a25b39fd8d5708557e17e7ec29..886f08f973c7057332e5ced07bad94e4b7c20283 100644 (file)
@@ -69,7 +69,7 @@ typedef struct pointer_entry  PTR_EN;     // block/line-count pair
 #define BLOCK0_ID1_C4  's'                 // block 0 id 1 'cm' 4
 
 #if defined(FEAT_CRYPT)
-static int id1_codes[] = {
+static const int id1_codes[] = {
     BLOCK0_ID1_C0,  // CRYPT_M_ZIP
     BLOCK0_ID1_C1,  // CRYPT_M_BF
     BLOCK0_ID1_C2,  // CRYPT_M_BF2
index 55bbf94d54790419388f4e8ca1f3262452674811..c615785c7eb5aea183fa3e83ed90db29c833e4d3 100644 (file)
--- a/src/pty.c
+++ b/src/pty.c
@@ -354,15 +354,15 @@ mch_openpty(char **ttyn)
 #ifndef PTY_DONE
 
 # ifdef hpux
-static char PtyProto[] = "/dev/ptym/ptyXY";
-static char TtyProto[] = "/dev/pty/ttyXY";
+static const char PtyProto[] = "/dev/ptym/ptyXY";
+static const char TtyProto[] = "/dev/pty/ttyXY";
 # else
 #  ifdef __HAIKU__
-static char PtyProto[] = "/dev/pt/XY";
-static char TtyProto[] = "/dev/tt/XY";
+static const char PtyProto[] = "/dev/pt/XY";
+static const char TtyProto[] = "/dev/tt/XY";
 #  else
-static char PtyProto[] = "/dev/ptyXY";
-static char TtyProto[] = "/dev/ttyXY";
+static const char PtyProto[] = "/dev/ptyXY";
+static const char TtyProto[] = "/dev/ttyXY";
 #  endif
 # endif
 
index 6ac74467f967507b46980d21f9749c3d6e6097ce..54fadc899eb1bfaafc45b914ff9438a74e61833b 100644 (file)
@@ -377,7 +377,7 @@ static int  reg_strict;     // "[abc" is illegal
  */
 
 // META[] is used often enough to justify turning it into a table.
-static char_u META_flags[] = {
+static const char_u META_flags[] = {
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 //                %  &     (  )  *  +        .
@@ -2908,7 +2908,7 @@ static regengine_T nfa_regengine =
 static int regexp_engine = 0;
 
 #ifdef DEBUG
-static char_u regname[][30] = {
+static const char_u regname[][30] = {
                    "AUTOMATIC Regexp Engine",
                    "BACKTRACKING Regexp Engine",
                    "NFA Regexp Engine"
index 063510c643e1790c68be130a494b96ce389a1807..a2877fc8de5d0fc90e27ff6c833a33ae56a66345 100644 (file)
@@ -253,7 +253,7 @@ static int  one_exactly = FALSE;    // only do one char for EXACTLY
 
 // When making changes to classchars also change nfa_classcodes.
 static char_u  *classchars = (char_u *)".iIkKfFpPsSdDxXoOwWhHaAlLuU";
-static int     classcodes[] = {
+static const int classcodes[] = {
     ANY, IDENT, SIDENT, KWORD, SKWORD,
     FNAME, SFNAME, PRINT, SPRINT,
     WHITE, NWHITE, DIGIT, NDIGIT,
index b17d4d34934aa32a1896c061238b8534332cb53d..610c6bd678ab5a49c8990dc89436beedcccc0e67 100644 (file)
@@ -233,7 +233,7 @@ enum
 };
 
 // Keep in sync with classchars.
-static int nfa_classcodes[] = {
+static const int nfa_classcodes[] = {
     NFA_ANY, NFA_IDENT, NFA_SIDENT, NFA_KWORD,NFA_SKWORD,
     NFA_FNAME, NFA_SFNAME, NFA_PRINT, NFA_SPRINT,
     NFA_WHITE, NFA_NWHITE, NFA_DIGIT, NFA_NDIGIT,
index bdf81bd6158b78348cf7fd0a5a504b6e842df8b8..da63f8a8453cdd28d49e93224a2c3de2c45ec5db 100644 (file)
@@ -689,7 +689,7 @@ static tcap_entry_T builtin_sync_output[] = {
 /*
  * List of DECRQM modes that Vim supports
  */
-static int dec_modes[] = {
+static const int dec_modes[] = {
     2026,   // Synchronized output
 #ifdef UNIX
     2048    // In-band terminal resize events
@@ -7827,11 +7827,11 @@ swap_tcap(void)
 
 
 #if (defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))) || defined(FEAT_TERMINAL)
-static int cube_value[] = {
+static const int cube_value[] = {
     0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF
 };
 
-static int grey_ramp[] = {
+static const int grey_ramp[] = {
     0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76,
     0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE
 };
index abd3f91c0f8fc338dad1c2f38d20b2aed8c0669d..e3dee3b3a58db33be377a1e10c8c63aab77ad6a8 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    298,
 /**/
     297,
 /**/