1 To: [email protected] |
|
2 Subject: Patch 7.2.423 |
|
3 Fcc: outbox |
|
4 From: Bram Moolenaar <[email protected]> |
|
5 Mime-Version: 1.0 |
|
6 Content-Type: text/plain; charset=UTF-8 |
|
7 Content-Transfer-Encoding: 8bit |
|
8 ------------ |
|
9 |
|
10 Patch 7.2.423 |
|
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) |
|
14 Files: src/eval.c |
|
15 |
|
16 |
|
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 |
|
19 *************** |
|
20 *** 145,153 **** |
|
21 dict_T sv_dict; |
|
22 } scriptvar_T; |
|
23 |
|
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) |
|
27 |
|
28 static int echo_attr = 0; /* attributes used for ":echo" */ |
|
29 |
|
30 --- 145,153 ---- |
|
31 dict_T sv_dict; |
|
32 } scriptvar_T; |
|
33 |
|
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) |
|
37 |
|
38 static int echo_attr = 0; /* attributes used for ":echo" */ |
|
39 |
|
40 *************** |
|
41 *** 866,875 **** |
|
42 hash_init(&vimvarht); /* garbage_collect() will access it */ |
|
43 hash_clear(&compat_hashtab); |
|
44 |
|
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); |
|
49 free_scriptnames(); |
|
50 |
|
51 /* global variables */ |
|
52 --- 866,871 ---- |
|
53 *************** |
|
54 *** 878,883 **** |
|
55 --- 874,887 ---- |
|
56 /* autoloaded script names */ |
|
57 ga_clear_strings(&ga_loaded); |
|
58 |
|
59 + /* script-local variables */ |
|
60 + for (i = 1; i <= ga_scripts.ga_len; ++i) |
|
61 + { |
|
62 + vars_clear(&SCRIPT_VARS(i)); |
|
63 + vim_free(SCRIPT_SV(i)); |
|
64 + } |
|
65 + ga_clear(&ga_scripts); |
|
66 + |
|
67 /* unreferenced lists and dicts */ |
|
68 (void)garbage_collect(); |
|
69 |
|
70 *************** |
|
71 *** 18803,18809 **** |
|
72 /* Must be something like "s:", otherwise "ht" would be NULL. */ |
|
73 switch (varname[-2]) |
|
74 { |
|
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; |
|
79 --- 18807,18813 ---- |
|
80 /* Must be something like "s:", otherwise "ht" would be NULL. */ |
|
81 switch (varname[-2]) |
|
82 { |
|
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; |
|
87 *************** |
|
88 *** 18928,18940 **** |
|
89 ht = &SCRIPT_VARS(i); |
|
90 if (ht->ht_mask == HT_INIT_SIZE - 1) |
|
91 ht->ht_array = ht->ht_smallarray; |
|
92 ! sv = &SCRIPT_SV(i); |
|
93 sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict; |
|
94 } |
|
95 |
|
96 while (ga_scripts.ga_len < id) |
|
97 { |
|
98 ! sv = &SCRIPT_SV(ga_scripts.ga_len + 1); |
|
99 init_var_dict(&sv->sv_dict, &sv->sv_var); |
|
100 ++ga_scripts.ga_len; |
|
101 } |
|
102 --- 18932,18945 ---- |
|
103 ht = &SCRIPT_VARS(i); |
|
104 if (ht->ht_mask == HT_INIT_SIZE - 1) |
|
105 ht->ht_array = ht->ht_smallarray; |
|
106 ! sv = SCRIPT_SV(i); |
|
107 sv->sv_var.di_tv.vval.v_dict = &sv->sv_dict; |
|
108 } |
|
109 |
|
110 while (ga_scripts.ga_len < id) |
|
111 { |
|
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); |
|
115 ++ga_scripts.ga_len; |
|
116 } |
|
117 *************** |
|
118 *** 21931,21937 **** |
|
119 if (find_viminfo_parameter('!') == NULL) |
|
120 return; |
|
121 |
|
122 ! fprintf(fp, _("\n# global variables:\n")); |
|
123 |
|
124 todo = (int)globvarht.ht_used; |
|
125 for (hi = globvarht.ht_array; todo > 0; ++hi) |
|
126 --- 21936,21942 ---- |
|
127 if (find_viminfo_parameter('!') == NULL) |
|
128 return; |
|
129 |
|
130 ! fputs(_("\n# global variables:\n"), fp); |
|
131 |
|
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 |
|
136 *************** |
|
137 *** 683,684 **** |
|
138 --- 683,686 ---- |
|
139 { /* Add new patch number below this line */ |
|
140 + /**/ |
|
141 + 423, |
|
142 /**/ |
|
143 |
|
144 -- |
|
145 He who laughs last, thinks slowest. |
|
146 |
|
147 /// Bram Moolenaar -- [email protected] -- 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 /// |
|