Commit 3b0dfa60 3b0dfa604bc0ff846020adefd7252dc7e27cadad by Sergey Poznyakoff

Bugfixes

* libmu_sieve/sieve.y (mu_sieve_machine_clone): Fix memory allocation.
* mh/pick.c: Remove unused functions.
1 parent fb8195c0
...@@ -1137,19 +1137,19 @@ mu_sieve_machine_clone (mu_sieve_machine_t const parent, ...@@ -1137,19 +1137,19 @@ mu_sieve_machine_clone (mu_sieve_machine_t const parent,
1137 } 1137 }
1138 1138
1139 /* Copy value space */ 1139 /* Copy value space */
1140 child->valspace = mu_sieve_calloc (parent, parent->valcount, 1140 child->valspace = mu_sieve_calloc (child, parent->valcount,
1141 sizeof child->valspace[0]); 1141 sizeof child->valspace[0]);
1142 child->valcount = child->valmax = parent->valcount; 1142 child->valcount = child->valmax = parent->valcount;
1143 for (i = 0; i < child->valcount; i++) 1143 for (i = 0; i < child->valcount; i++)
1144 { 1144 {
1145 child->valspace[i].type = parent->valspace[i].type; 1145 child->valspace[i].type = parent->valspace[i].type;
1146 child->valspace[i].tag = 1146 child->valspace[i].tag =
1147 mu_sieve_strdup (parent, parent->valspace[i].tag); 1147 mu_sieve_strdup (child, parent->valspace[i].tag);
1148 switch (child->valspace[i].type) 1148 switch (child->valspace[i].type)
1149 { 1149 {
1150 case SVT_TAG: 1150 case SVT_TAG:
1151 child->valspace[i].v.string = 1151 child->valspace[i].v.string =
1152 mu_sieve_strdup (parent, parent->valspace[i].v.string); 1152 mu_sieve_strdup (child, parent->valspace[i].v.string);
1153 break; 1153 break;
1154 1154
1155 default: 1155 default:
......
...@@ -232,34 +232,6 @@ action_add (void *item, void *data) ...@@ -232,34 +232,6 @@ action_add (void *item, void *data)
232 return 0; 232 return 0;
233 } 233 }
234 234
235 static void
236 parse_comp_match (int *pargc, char **argv)
237 {
238 int i, j;
239 int argc = *pargc;
240
241 for (i = j = 0; i < argc; i++)
242 {
243 if (strncmp (argv[i], "--", 2) == 0)
244 {
245 if (++i < argc)
246 {
247 pick_add_token (&lexlist, T_COMP, argv[i-1] + 2);
248 pick_add_token (&lexlist, T_STRING, argv[i]);
249 }
250 else
251 {
252 mu_error (_("%s: must be followed by a pattern"), argv[i-1]);
253 exit (1);
254 }
255 }
256 else
257 argv[j++] = argv[i];
258 }
259 argv[j] = NULL;
260 *pargc = j;
261 }
262
263 int 235 int
264 main (int argc, char **argv) 236 main (int argc, char **argv)
265 { 237 {
...@@ -268,6 +240,7 @@ main (int argc, char **argv) ...@@ -268,6 +240,7 @@ main (int argc, char **argv)
268 mu_msgset_t msgset; 240 mu_msgset_t msgset;
269 int argv_alloc = 0; 241 int argv_alloc = 0;
270 242
243 /* Expand eventual --COMPONENT NAME pairs */
271 for (i = 1; i < argc;) 244 for (i = 1; i < argc;)
272 { 245 {
273 if (strncmp (argv[i], "--", 2) == 0 && argv[i][3] && i + 1 < argc) 246 if (strncmp (argv[i], "--", 2) == 0 && argv[i][3] && i + 1 < argc)
...@@ -299,8 +272,6 @@ main (int argc, char **argv) ...@@ -299,8 +272,6 @@ main (int argc, char **argv)
299 mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER, 272 mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER,
300 args_doc, prog_doc, NULL); 273 args_doc, prog_doc, NULL);
301 274
302 parse_comp_match (&argc, argv);
303
304 if (pick_parse (lexlist)) 275 if (pick_parse (lexlist))
305 return 1; 276 return 1;
306 277
......