@@ -919,6 +919,8 @@ eval_init(void)
919919 /* add to compat scope dict */
920920 hash_add(&compat_hashtab, p->vv_di.di_key);
921921 }
922+ vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
923+
922924 set_vim_var_nr(VV_SEARCHFORWARD, 1L);
923925 set_vim_var_nr(VV_HLSEARCH, 1L);
924926 set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
@@ -20616,11 +20618,8 @@ set_vim_var_string(
2061620618 char_u *val,
2061720619 int len) /* length of "val" to use or -1 (whole string) */
2061820620{
20619- /* Need to do this (at least) once, since we can't initialize a union.
20620- * Will always be invoked when "v:progname" is set. */
20621- vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
20622-
20623- vim_free(vimvars[idx].vv_str);
20621+ clear_tv(&vimvars[idx].vv_di.di_tv);
20622+ vimvars[idx].vv_type = VAR_STRING;
2062420623 if (val == NULL)
2062520624 vimvars[idx].vv_str = NULL;
2062620625 else if (len == -1)
@@ -20635,7 +20634,8 @@ set_vim_var_string(
2063520634 void
2063620635set_vim_var_list(int idx, list_T *val)
2063720636{
20638- list_unref(vimvars[idx].vv_list);
20637+ clear_tv(&vimvars[idx].vv_di.di_tv);
20638+ vimvars[idx].vv_type = VAR_LIST;
2063920639 vimvars[idx].vv_list = val;
2064020640 if (val != NULL)
2064120641 ++val->lv_refcount;
@@ -20650,7 +20650,8 @@ set_vim_var_dict(int idx, dict_T *val)
2065020650 int todo;
2065120651 hashitem_T *hi;
2065220652
20653- dict_unref(vimvars[idx].vv_dict);
20653+ clear_tv(&vimvars[idx].vv_di.di_tv);
20654+ vimvars[idx].vv_type = VAR_DICT;
2065420655 vimvars[idx].vv_dict = val;
2065520656 if (val != NULL)
2065620657 {
0 commit comments