patch 9.2.0471: vimvars di_key initialized at runtime

Commit: 
https://github.com/vim/vim/commit/1b65cfbac5c5bbad108548908e77697111ad4a3f
Author: John Marriott <[email protected]>
Date:   Mon May 11 16:22:05 2026 +0000

    patch 9.2.0471: vimvars di_key initialized at runtime
    
    Problem:  evalvars_init() copies each vimvar's name into di_key at
              startup and runtime-checks that the name fits in
              DICTITEM16_KEY_LEN, even though all names are known at
              compile time.
    Solution: Embed the name in di_key via the VV_NAME macro so the
              initialization happens at compile time.  Drop the
              runtime length check and the STRCPY loop (John Marriott).
    
    closes: #20185
    
    Signed-off-by: John Marriott <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/evalvars.c b/src/evalvars.c
index 1df4af997..9b98ae731 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -37,7 +37,7 @@ static hashtab_T      compat_hashtab;
 #define VV_RO          2       // read-only
 #define VV_RO_SBX      4       // read-only in the sandbox
 
-#define VV_NAME(s, t)  s, {{t, 0, {0}}, 0, {0}}
+#define VV_NAME(s, t)  s, {{t, 0, {0}}, 0, {s}}
 
 typedef struct vimvar vimvar_T;
 
@@ -216,12 +216,6 @@ evalvars_init(void)
     for (i = 0; i < VV_LEN; ++i)
     {
        p = &vimvars[i];
-       if (STRLEN(p->vv_name) > DICTITEM16_KEY_LEN)
-       {
-           iemsg("Name too long, increase size of dictitem16_T");
-           getout(1);
-       }
-       STRCPY(p->vv_di.di_key, p->vv_name);
        if (p->vv_flags & VV_RO)
            p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
        else if (p->vv_flags & VV_RO_SBX)
diff --git a/src/version.c b/src/version.c
index 5e5f17f85..875c6f674 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    471,
 /**/
     470,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wMTWD-00HIrf-0A%40256bit.org.

Raspunde prin e-mail lui