4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Crash when assigning s: to variable. (Yukihiro Nakadaira)
12 Solution: Make ga_scripts contain pointer to scriptvar_T instead of
13 scriptvar_T itself. (Dominique Pelle)
17 *** ../vim-7.2.422/src/eval.c 2010-03-17 19:53:44.000000000 +0100
18 --- src/eval.c 2010-05-14 12:02:16.000000000 +0200
24 ! static garray_T ga_scripts = {0, 0, sizeof(scriptvar_T), 4, NULL};
25 ! #define SCRIPT_SV(id) (((scriptvar_T *)ga_scripts.ga_data)[(id) - 1])
26 ! #define SCRIPT_VARS(id) (SCRIPT_SV(id).sv_dict.dv_hashtab)
28 static int echo_attr = 0; /* attributes used for ":echo" */
34 ! static garray_T ga_scripts = {0, 0, sizeof(scriptvar_T *), 4, NULL};
35 ! #define SCRIPT_SV(id) (((scriptvar_T **)ga_scripts.ga_data)[(id) - 1])
36 ! #define SCRIPT_VARS(id) (SCRIPT_SV(id)->sv_dict.dv_hashtab)
38 static int echo_attr = 0; /* attributes used for ":echo" */
42 hash_init(&vimvarht); /* garbage_collect() will access it */
43 hash_clear(&compat_hashtab);
45 - /* script-local variables */
46 - for (i = 1; i <= ga_scripts.ga_len; ++i)
47 - vars_clear(&SCRIPT_VARS(i));
48 - ga_clear(&ga_scripts);
51 /* global variables */
56 /* autoloaded script names */
57 ga_clear_strings(&ga_loaded);
59 + /* script-local variables */
60 + for (i = 1; i <= ga_scripts.ga_len; ++i)
62 + vars_clear(&SCRIPT_VARS(i));
63 + vim_free(SCRIPT_SV(i));
65 + ga_clear(&ga_scripts);
67 /* unreferenced lists and dicts */
68 (void)garbage_collect();
72 /* Must be something like "s:", otherwise "ht" would be NULL. */
75 ! case 's': return &SCRIPT_SV(current_SID).sv_var;
76 case 'g': return &globvars_var;
77 case 'v': return &vimvars_var;
78 case 'b': return &curbuf->b_bufvar;
80 /* Must be something like "s:", otherwise "ht" would be NULL. */
83 ! case 's': return &SCRIPT_SV(current_SID)->sv_var;
84 case 'g': return &globvars_var;
85 case 'v': return &vimvars_var;
86 case 'b': return &curbuf->b_bufvar;
90 if (ht->ht_mask == HT_INIT_SIZE - 1)
91 ht->ht_array = ht->ht_smallarray;
93 sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict;
96 while (ga_scripts.ga_len < id)
98 ! sv = &SCRIPT_SV(ga_scripts.ga_len + 1);
99 init_var_dict(&sv->sv_dict, &sv->sv_var);
103 ht = &SCRIPT_VARS(i);
104 if (ht->ht_mask == HT_INIT_SIZE - 1)
105 ht->ht_array = ht->ht_smallarray;
107 sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict;
110 while (ga_scripts.ga_len < id)
112 ! sv = SCRIPT_SV(ga_scripts.ga_len + 1) =
113 ! (scriptvar_T *)alloc_clear(sizeof(scriptvar_T));
114 init_var_dict(&sv->sv_dict, &sv->sv_var);
119 if (find_viminfo_parameter('!') == NULL)
122 ! fprintf(fp, _("\n# global variables:\n"));
124 todo = (int)globvarht.ht_used;
125 for (hi = globvarht.ht_array; todo > 0; ++hi)
127 if (find_viminfo_parameter('!') == NULL)
130 ! fputs(_("\n# global variables:\n"), fp);
132 todo = (int)globvarht.ht_used;
133 for (hi = globvarht.ht_array; todo > 0; ++hi)
134 *** ../vim-7.2.422/src/version.c 2010-05-13 17:46:53.000000000 +0200
135 --- src/version.c 2010-05-14 12:13:19.000000000 +0200
139 { /* Add new patch number below this line */
145 He who laughs last, thinks slowest.
147 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
148 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
149 \\\ download, build and distribute -- http://www.A-A-P.org ///
150 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///