Cleanup
* include/mailutils/sieve.h (SVT_IDENT): Remove. * libmu_sieve/comparator.c (mu_sieve_match_part_checker): Remove unused variable. * libmu_sieve/mem.c (mu_sieve_reclaim_list): Remove function. * libmu_sieve/sieve.y: Remove leftover uses of SVT_IDENT. * libmu_sieve/util.c: Likewise. * libmu_sieve/sieve-priv.h: Remove useless prototypes.
Showing
7 changed files
with
19 additions
and
46 deletions
gint @ 42f47120
... | @@ -61,14 +61,15 @@ typedef enum | ... | @@ -61,14 +61,15 @@ typedef enum |
61 | SVT_STRING, | 61 | SVT_STRING, |
62 | SVT_STRING_LIST, | 62 | SVT_STRING_LIST, |
63 | SVT_TAG, | 63 | SVT_TAG, |
64 | SVT_IDENT | ||
65 | } | 64 | } |
66 | mu_sieve_data_type; | 65 | mu_sieve_data_type; |
67 | 66 | ||
67 | /* Struct mu_sieve_slice represents a contiguous slice of an array of strings | ||
68 | or variables */ | ||
68 | struct mu_sieve_slice | 69 | struct mu_sieve_slice |
69 | { | 70 | { |
70 | size_t first; | 71 | size_t first; /* Index of the first object */ |
71 | size_t count; | 72 | size_t count; /* Number of objects */ |
72 | }; | 73 | }; |
73 | 74 | ||
74 | typedef struct mu_sieve_slice *mu_sieve_slice_t; | 75 | typedef struct mu_sieve_slice *mu_sieve_slice_t; |
... | @@ -122,13 +123,11 @@ extern mu_debug_handle_t mu_sieve_debug_handle; | ... | @@ -122,13 +123,11 @@ extern mu_debug_handle_t mu_sieve_debug_handle; |
122 | extern mu_list_t mu_sieve_include_path; | 123 | extern mu_list_t mu_sieve_include_path; |
123 | extern mu_list_t mu_sieve_library_path; | 124 | extern mu_list_t mu_sieve_library_path; |
124 | extern mu_list_t mu_sieve_library_path_prefix; | 125 | extern mu_list_t mu_sieve_library_path_prefix; |
125 | |||
126 | void mu_sieve_debug_init (void); | ||
127 | 126 | ||
128 | /* Memory allocation functions */ | 127 | /* Memory allocation functions */ |
129 | typedef void (*mu_sieve_reclaim_t) (void *); | 128 | typedef void (*mu_sieve_reclaim_t) (void *); |
130 | void mu_sieve_register_memory (mu_sieve_machine_t mach, void *ptr, | 129 | void mu_sieve_register_memory (mu_sieve_machine_t mach, void *ptr, |
131 | mu_sieve_reclaim_t reclaim); | 130 | mu_sieve_reclaim_t reclaim); |
132 | void *mu_sieve_alloc_memory (mu_sieve_machine_t mach, size_t size, | 131 | void *mu_sieve_alloc_memory (mu_sieve_machine_t mach, size_t size, |
133 | mu_sieve_reclaim_t recfun); | 132 | mu_sieve_reclaim_t recfun); |
134 | void mu_sieve_free (mu_sieve_machine_t mach, void *ptr); | 133 | void mu_sieve_free (mu_sieve_machine_t mach, void *ptr); |
... | @@ -138,7 +137,6 @@ char *mu_sieve_strdup (mu_sieve_machine_t mach, char const *str); | ... | @@ -138,7 +137,6 @@ char *mu_sieve_strdup (mu_sieve_machine_t mach, char const *str); |
138 | void *mu_sieve_realloc (mu_sieve_machine_t mach, void *ptr, size_t size); | 137 | void *mu_sieve_realloc (mu_sieve_machine_t mach, void *ptr, size_t size); |
139 | 138 | ||
140 | void mu_sieve_reclaim_default (void *p); | 139 | void mu_sieve_reclaim_default (void *p); |
141 | void mu_sieve_reclaim_list (void *p); | ||
142 | void mu_sieve_reclaim_value (void *p); | 140 | void mu_sieve_reclaim_value (void *p); |
143 | 141 | ||
144 | size_t mu_sieve_value_create (mu_sieve_machine_t mach, | 142 | size_t mu_sieve_value_create (mu_sieve_machine_t mach, |
... | @@ -179,6 +177,9 @@ int mu_sieve_require_test (mu_sieve_machine_t mach, const char *name); | ... | @@ -179,6 +177,9 @@ int mu_sieve_require_test (mu_sieve_machine_t mach, const char *name); |
179 | int mu_sieve_require_comparator (mu_sieve_machine_t mach, const char *name); | 177 | int mu_sieve_require_comparator (mu_sieve_machine_t mach, const char *name); |
180 | int mu_sieve_require_relational (mu_sieve_machine_t mach, const char *name); | 178 | int mu_sieve_require_relational (mu_sieve_machine_t mach, const char *name); |
181 | 179 | ||
180 | int mu_sieve_load_ext (mu_sieve_machine_t mach, const char *name); | ||
181 | int mu_sieve_match_part_checker (mu_sieve_machine_t mach); | ||
182 | |||
182 | mu_sieve_comparator_t mu_sieve_comparator_lookup (mu_sieve_machine_t mach, | 183 | mu_sieve_comparator_t mu_sieve_comparator_lookup (mu_sieve_machine_t mach, |
183 | const char *name, | 184 | const char *name, |
184 | int matchtype); | 185 | int matchtype); |
... | @@ -192,24 +193,21 @@ void mu_sieve_require (mu_sieve_machine_t mach, mu_sieve_slice_t list); | ... | @@ -192,24 +193,21 @@ void mu_sieve_require (mu_sieve_machine_t mach, mu_sieve_slice_t list); |
192 | 193 | ||
193 | void mu_sieve_value_get (mu_sieve_machine_t mach, mu_sieve_value_t *val, | 194 | void mu_sieve_value_get (mu_sieve_machine_t mach, mu_sieve_value_t *val, |
194 | mu_sieve_data_type type, void *ret); | 195 | mu_sieve_data_type type, void *ret); |
195 | 196 | /* Tagged argument accessors */ | |
196 | int mu_sieve_get_tag (mu_sieve_machine_t mach, char *name, | 197 | int mu_sieve_get_tag (mu_sieve_machine_t mach, char *name, |
197 | mu_sieve_data_type type, void *ret); | 198 | mu_sieve_data_type type, void *ret); |
198 | mu_sieve_value_t *mu_sieve_get_tag_untyped (mu_sieve_machine_t mach, | 199 | mu_sieve_value_t *mu_sieve_get_tag_untyped (mu_sieve_machine_t mach, |
199 | char const *name); | 200 | char const *name); |
200 | mu_sieve_value_t *mu_sieve_get_tag_n (mu_sieve_machine_t mach, size_t n); | 201 | mu_sieve_value_t *mu_sieve_get_tag_n (mu_sieve_machine_t mach, size_t n); |
201 | 202 | ||
202 | int mu_sieve_load_ext (mu_sieve_machine_t mach, const char *name); | 203 | /* Positional argument accessors */ |
203 | int mu_sieve_match_part_checker (mu_sieve_machine_t mach); | ||
204 | |||
205 | /* Operations on value lists */ | ||
206 | mu_sieve_value_t *mu_sieve_get_arg_optional (mu_sieve_machine_t mach, | 204 | mu_sieve_value_t *mu_sieve_get_arg_optional (mu_sieve_machine_t mach, |
207 | size_t index); | 205 | size_t index); |
208 | mu_sieve_value_t *mu_sieve_get_arg_untyped (mu_sieve_machine_t mach, | 206 | mu_sieve_value_t *mu_sieve_get_arg_untyped (mu_sieve_machine_t mach, |
209 | size_t index); | 207 | size_t index); |
210 | void mu_sieve_get_arg (mu_sieve_machine_t mach, size_t index, | 208 | void mu_sieve_get_arg (mu_sieve_machine_t mach, size_t index, |
211 | mu_sieve_data_type type, void *ret); | 209 | mu_sieve_data_type type, void *ret); |
212 | 210 | /* String and string list accessors */ | |
213 | char *mu_sieve_string (mu_sieve_machine_t mach, | 211 | char *mu_sieve_string (mu_sieve_machine_t mach, |
214 | mu_sieve_slice_t slice, | 212 | mu_sieve_slice_t slice, |
215 | size_t i); | 213 | size_t i); |
... | @@ -217,7 +215,7 @@ struct mu_sieve_string *mu_sieve_string_raw (mu_sieve_machine_t mach, | ... | @@ -217,7 +215,7 @@ struct mu_sieve_string *mu_sieve_string_raw (mu_sieve_machine_t mach, |
217 | mu_sieve_slice_t slice, | 215 | mu_sieve_slice_t slice, |
218 | size_t i); | 216 | size_t i); |
219 | 217 | ||
220 | 218 | /* Operations on value lists */ | |
221 | int mu_sieve_vlist_do (mu_sieve_machine_t mach, | 219 | int mu_sieve_vlist_do (mu_sieve_machine_t mach, |
222 | mu_sieve_value_t *val, mu_list_action_t ac, | 220 | mu_sieve_value_t *val, mu_list_action_t ac, |
223 | void *data); | 221 | void *data); |
... | @@ -270,6 +268,7 @@ void mu_sieve_stream_restore (mu_sieve_machine_t mach); | ... | @@ -270,6 +268,7 @@ void mu_sieve_stream_restore (mu_sieve_machine_t mach); |
270 | 268 | ||
271 | /* Logging and diagnostic functions */ | 269 | /* Logging and diagnostic functions */ |
272 | 270 | ||
271 | void mu_sieve_debug_init (void); | ||
273 | void mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...) | 272 | void mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...) |
274 | MU_PRINTFLIKE(2,3); | 273 | MU_PRINTFLIKE(2,3); |
275 | void mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, | 274 | void mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, |
... | @@ -277,7 +276,6 @@ void mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, | ... | @@ -277,7 +276,6 @@ void mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, |
277 | MU_PRINTFLIKE(3,4); | 276 | MU_PRINTFLIKE(3,4); |
278 | void mu_sieve_abort (mu_sieve_machine_t mach); | 277 | void mu_sieve_abort (mu_sieve_machine_t mach); |
279 | 278 | ||
280 | int mu_sieve_is_dry_run (mu_sieve_machine_t mach); | ||
281 | const char *mu_sieve_type_str (mu_sieve_data_type type); | 279 | const char *mu_sieve_type_str (mu_sieve_data_type type); |
282 | 280 | ||
283 | /* Principal entry points */ | 281 | /* Principal entry points */ | ... | ... |
... | @@ -217,7 +217,6 @@ mu_sieve_match_part_checker (mu_sieve_machine_t mach) | ... | @@ -217,7 +217,6 @@ mu_sieve_match_part_checker (mu_sieve_machine_t mach) |
217 | { | 217 | { |
218 | mu_sieve_value_t *val; | 218 | mu_sieve_value_t *val; |
219 | char *str; | 219 | char *str; |
220 | size_t count; | ||
221 | 220 | ||
222 | if (compname && strcmp (compname, "i;ascii-numeric")) | 221 | if (compname && strcmp (compname, "i;ascii-numeric")) |
223 | { | 222 | { |
... | @@ -247,7 +246,7 @@ mu_sieve_match_part_checker (mu_sieve_machine_t mach) | ... | @@ -247,7 +246,7 @@ mu_sieve_match_part_checker (mu_sieve_machine_t mach) |
247 | return 1; | 246 | return 1; |
248 | } | 247 | } |
249 | str = mu_sieve_string_raw (mach, &val->v.list, 0)->orig; | 248 | str = mu_sieve_string_raw (mach, &val->v.list, 0)->orig; |
250 | count = strtoul (str, &str, 10); | 249 | str = mu_str_skip_class (str, MU_CTYPE_DIGIT); |
251 | if (*str) | 250 | if (*str) |
252 | { | 251 | { |
253 | mu_diag_at_locus (MU_LOG_ERROR, &mach->locus, | 252 | mu_diag_at_locus (MU_LOG_ERROR, &mach->locus, | ... | ... |
... | @@ -181,13 +181,6 @@ mu_sieve_reclaim_default (void *p) | ... | @@ -181,13 +181,6 @@ mu_sieve_reclaim_default (void *p) |
181 | free (p); | 181 | free (p); |
182 | } | 182 | } |
183 | 183 | ||
184 | void | ||
185 | mu_sieve_reclaim_list (void *p) | ||
186 | { | ||
187 | mu_list_t list = p; | ||
188 | mu_list_destroy (&list); | ||
189 | } | ||
190 | |||
191 | void | 184 | void |
192 | mu_sieve_reclaim_value (void *p) | 185 | mu_sieve_reclaim_value (void *p) |
193 | { | 186 | { | ... | ... |
... | @@ -29,7 +29,6 @@ typedef union | ... | @@ -29,7 +29,6 @@ typedef union |
29 | mu_sieve_handler_t handler; | 29 | mu_sieve_handler_t handler; |
30 | mu_sieve_value_t *val; | 30 | mu_sieve_value_t *val; |
31 | mu_sieve_comparator_t comp; | 31 | mu_sieve_comparator_t comp; |
32 | mu_list_t list; | ||
33 | long number; | 32 | long number; |
34 | size_t pc; | 33 | size_t pc; |
35 | size_t line; | 34 | size_t line; |
... | @@ -69,10 +68,10 @@ struct mu_sieve_machine | ... | @@ -69,10 +68,10 @@ struct mu_sieve_machine |
69 | 68 | ||
70 | /* Symbol space: */ | 69 | /* Symbol space: */ |
71 | mu_opool_t string_pool; /* String constants */ | 70 | mu_opool_t string_pool; /* String constants */ |
71 | mu_list_t source_list; /* Source names (for diagnostics) */ | ||
72 | mu_list_t test_list; /* Tests */ | 72 | mu_list_t test_list; /* Tests */ |
73 | mu_list_t action_list; /* Actions */ | 73 | mu_list_t action_list; /* Actions */ |
74 | mu_list_t comp_list; /* Comparators */ | 74 | mu_list_t comp_list; /* Comparators */ |
75 | mu_list_t source_list; /* Source names (for diagnostics) */ | ||
76 | 75 | ||
77 | mu_sieve_string_t *stringspace; | 76 | mu_sieve_string_t *stringspace; |
78 | size_t stringcount; | 77 | size_t stringcount; |
... | @@ -86,7 +85,7 @@ struct mu_sieve_machine | ... | @@ -86,7 +85,7 @@ struct mu_sieve_machine |
86 | sieve_op_t *prog; /* Compiled program */ | 85 | sieve_op_t *prog; /* Compiled program */ |
87 | 86 | ||
88 | /* Runtime data */ | 87 | /* Runtime data */ |
89 | enum mu_sieve_state state; | 88 | enum mu_sieve_state state; /* Machine state */ |
90 | size_t pc; /* Current program counter */ | 89 | size_t pc; /* Current program counter */ |
91 | long reg; /* Numeric register */ | 90 | long reg; /* Numeric register */ |
92 | mu_list_t stack; /* Runtime stack */ | 91 | mu_list_t stack; /* Runtime stack */ |
... | @@ -144,8 +143,6 @@ struct mu_sieve_node | ... | @@ -144,8 +143,6 @@ struct mu_sieve_node |
144 | struct mu_locus_range locus; | 143 | struct mu_locus_range locus; |
145 | union | 144 | union |
146 | { | 145 | { |
147 | mu_sieve_value_t *value; | ||
148 | mu_list_t list; | ||
149 | struct mu_sieve_node *node; | 146 | struct mu_sieve_node *node; |
150 | struct | 147 | struct |
151 | { | 148 | { |
... | @@ -176,9 +173,6 @@ extern mu_sieve_machine_t mu_sieve_machine; | ... | @@ -176,9 +173,6 @@ extern mu_sieve_machine_t mu_sieve_machine; |
176 | 173 | ||
177 | void mu_i_sv_code (struct mu_sieve_machine *mach, sieve_op_t op); | 174 | void mu_i_sv_code (struct mu_sieve_machine *mach, sieve_op_t op); |
178 | 175 | ||
179 | void mu_i_sv_compile_error (struct mu_sieve_machine *mach, | ||
180 | const char *fmt, ...) MU_PRINTFLIKE(2,3); | ||
181 | |||
182 | int mu_i_sv_locus (struct mu_sieve_machine *mach, struct mu_locus_range *lr); | 176 | int mu_i_sv_locus (struct mu_sieve_machine *mach, struct mu_locus_range *lr); |
183 | void mu_i_sv_code_action (struct mu_sieve_machine *mach, | 177 | void mu_i_sv_code_action (struct mu_sieve_machine *mach, |
184 | struct mu_sieve_node *node); | 178 | struct mu_sieve_node *node); |
... | @@ -203,9 +197,6 @@ void mu_i_sv_register_standard_actions (mu_sieve_machine_t mach); | ... | @@ -203,9 +197,6 @@ void mu_i_sv_register_standard_actions (mu_sieve_machine_t mach); |
203 | void mu_i_sv_register_standard_tests (mu_sieve_machine_t mach); | 197 | void mu_i_sv_register_standard_tests (mu_sieve_machine_t mach); |
204 | void mu_i_sv_register_standard_comparators (mu_sieve_machine_t mach); | 198 | void mu_i_sv_register_standard_comparators (mu_sieve_machine_t mach); |
205 | 199 | ||
206 | void mu_i_sv_print_value_list (mu_list_t list, mu_stream_t str); | ||
207 | void mu_i_sv_print_tag_list (mu_list_t list, mu_stream_t str); | ||
208 | |||
209 | void mu_i_sv_error (mu_sieve_machine_t mach); | 200 | void mu_i_sv_error (mu_sieve_machine_t mach); |
210 | 201 | ||
211 | void mu_i_sv_debug (mu_sieve_machine_t mach, size_t pc, const char *fmt, ...) | 202 | void mu_i_sv_debug (mu_sieve_machine_t mach, size_t pc, const char *fmt, ...) |
... | @@ -214,7 +205,8 @@ void mu_i_sv_debug_command (mu_sieve_machine_t mach, size_t pc, | ... | @@ -214,7 +205,8 @@ void mu_i_sv_debug_command (mu_sieve_machine_t mach, size_t pc, |
214 | char const *what); | 205 | char const *what); |
215 | void mu_i_sv_trace (mu_sieve_machine_t mach, const char *what); | 206 | void mu_i_sv_trace (mu_sieve_machine_t mach, const char *what); |
216 | 207 | ||
217 | void mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str, mu_sieve_value_t *val); | 208 | void mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str, |
209 | mu_sieve_value_t *val); | ||
218 | 210 | ||
219 | typedef int (*mu_i_sv_interp_t) (char const *, size_t, char **, void *); | 211 | typedef int (*mu_i_sv_interp_t) (char const *, size_t, char **, void *); |
220 | 212 | ... | ... |
... | @@ -547,10 +547,6 @@ mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str, mu_sieve_value_t *val) | ... | @@ -547,10 +547,6 @@ mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str, mu_sieve_value_t *val) |
547 | mu_stream_printf (str, ":%s", val->v.string); | 547 | mu_stream_printf (str, ":%s", val->v.string); |
548 | break; | 548 | break; |
549 | 549 | ||
550 | case SVT_IDENT: | ||
551 | mu_stream_printf (str, "%s", val->v.string); | ||
552 | break; | ||
553 | |||
554 | default: | 550 | default: |
555 | abort (); | 551 | abort (); |
556 | } | 552 | } | ... | ... |
... | @@ -59,7 +59,6 @@ mu_sieve_value_create (mu_sieve_machine_t mach, mu_sieve_data_type type, | ... | @@ -59,7 +59,6 @@ mu_sieve_value_create (mu_sieve_machine_t mach, mu_sieve_data_type type, |
59 | break; | 59 | break; |
60 | 60 | ||
61 | case SVT_TAG: | 61 | case SVT_TAG: |
62 | case SVT_IDENT: | ||
63 | val->v.string = data; | 62 | val->v.string = data; |
64 | break; | 63 | break; |
65 | 64 | ||
... | @@ -142,7 +141,6 @@ mu_sieve_value_get (mu_sieve_machine_t mach, mu_sieve_value_t *val, | ... | @@ -142,7 +141,6 @@ mu_sieve_value_get (mu_sieve_machine_t mach, mu_sieve_value_t *val, |
142 | break; | 141 | break; |
143 | 142 | ||
144 | case SVT_TAG: | 143 | case SVT_TAG: |
145 | case SVT_IDENT: | ||
146 | *(char**) ret = val->v.string; | 144 | *(char**) ret = val->v.string; |
147 | break; | 145 | break; |
148 | 146 | ||
... | @@ -237,9 +235,6 @@ mu_sieve_type_str (mu_sieve_data_type type) | ... | @@ -237,9 +235,6 @@ mu_sieve_type_str (mu_sieve_data_type type) |
237 | case SVT_TAG: | 235 | case SVT_TAG: |
238 | return "tag"; | 236 | return "tag"; |
239 | 237 | ||
240 | case SVT_IDENT: | ||
241 | return "ident"; | ||
242 | |||
243 | } | 238 | } |
244 | 239 | ||
245 | return "unknown"; | 240 | return "unknown"; | ... | ... |
-
Please register or sign in to post a comment