Commit f0d3890a f0d3890af4f5df7aaec91bb13306ca55908ada25 by Sergey Poznyakoff

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.
1 parent 15f6dbf6
gint @ 42f47120
Subproject commit fd86bf7d44b0c970771830692ae7491447ebe8b1
Subproject commit 42f4712085b40173eaea58e14b1a579291a6fe3a
......
......@@ -61,14 +61,15 @@ typedef enum
SVT_STRING,
SVT_STRING_LIST,
SVT_TAG,
SVT_IDENT
}
mu_sieve_data_type;
/* Struct mu_sieve_slice represents a contiguous slice of an array of strings
or variables */
struct mu_sieve_slice
{
size_t first;
size_t count;
size_t first; /* Index of the first object */
size_t count; /* Number of objects */
};
typedef struct mu_sieve_slice *mu_sieve_slice_t;
......@@ -122,13 +123,11 @@ extern mu_debug_handle_t mu_sieve_debug_handle;
extern mu_list_t mu_sieve_include_path;
extern mu_list_t mu_sieve_library_path;
extern mu_list_t mu_sieve_library_path_prefix;
void mu_sieve_debug_init (void);
/* Memory allocation functions */
typedef void (*mu_sieve_reclaim_t) (void *);
void mu_sieve_register_memory (mu_sieve_machine_t mach, void *ptr,
mu_sieve_reclaim_t reclaim);
mu_sieve_reclaim_t reclaim);
void *mu_sieve_alloc_memory (mu_sieve_machine_t mach, size_t size,
mu_sieve_reclaim_t recfun);
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);
void *mu_sieve_realloc (mu_sieve_machine_t mach, void *ptr, size_t size);
void mu_sieve_reclaim_default (void *p);
void mu_sieve_reclaim_list (void *p);
void mu_sieve_reclaim_value (void *p);
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);
int mu_sieve_require_comparator (mu_sieve_machine_t mach, const char *name);
int mu_sieve_require_relational (mu_sieve_machine_t mach, const char *name);
int mu_sieve_load_ext (mu_sieve_machine_t mach, const char *name);
int mu_sieve_match_part_checker (mu_sieve_machine_t mach);
mu_sieve_comparator_t mu_sieve_comparator_lookup (mu_sieve_machine_t mach,
const char *name,
int matchtype);
......@@ -192,24 +193,21 @@ void mu_sieve_require (mu_sieve_machine_t mach, mu_sieve_slice_t list);
void mu_sieve_value_get (mu_sieve_machine_t mach, mu_sieve_value_t *val,
mu_sieve_data_type type, void *ret);
/* Tagged argument accessors */
int mu_sieve_get_tag (mu_sieve_machine_t mach, char *name,
mu_sieve_data_type type, void *ret);
mu_sieve_value_t *mu_sieve_get_tag_untyped (mu_sieve_machine_t mach,
char const *name);
mu_sieve_value_t *mu_sieve_get_tag_n (mu_sieve_machine_t mach, size_t n);
int mu_sieve_load_ext (mu_sieve_machine_t mach, const char *name);
int mu_sieve_match_part_checker (mu_sieve_machine_t mach);
/* Operations on value lists */
/* Positional argument accessors */
mu_sieve_value_t *mu_sieve_get_arg_optional (mu_sieve_machine_t mach,
size_t index);
mu_sieve_value_t *mu_sieve_get_arg_untyped (mu_sieve_machine_t mach,
size_t index);
void mu_sieve_get_arg (mu_sieve_machine_t mach, size_t index,
mu_sieve_data_type type, void *ret);
/* String and string list accessors */
char *mu_sieve_string (mu_sieve_machine_t mach,
mu_sieve_slice_t slice,
size_t i);
......@@ -217,7 +215,7 @@ struct mu_sieve_string *mu_sieve_string_raw (mu_sieve_machine_t mach,
mu_sieve_slice_t slice,
size_t i);
/* Operations on value lists */
int mu_sieve_vlist_do (mu_sieve_machine_t mach,
mu_sieve_value_t *val, mu_list_action_t ac,
void *data);
......@@ -270,6 +268,7 @@ void mu_sieve_stream_restore (mu_sieve_machine_t mach);
/* Logging and diagnostic functions */
void mu_sieve_debug_init (void);
void mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...)
MU_PRINTFLIKE(2,3);
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,
MU_PRINTFLIKE(3,4);
void mu_sieve_abort (mu_sieve_machine_t mach);
int mu_sieve_is_dry_run (mu_sieve_machine_t mach);
const char *mu_sieve_type_str (mu_sieve_data_type type);
/* Principal entry points */
......
......@@ -217,7 +217,6 @@ mu_sieve_match_part_checker (mu_sieve_machine_t mach)
{
mu_sieve_value_t *val;
char *str;
size_t count;
if (compname && strcmp (compname, "i;ascii-numeric"))
{
......@@ -247,7 +246,7 @@ mu_sieve_match_part_checker (mu_sieve_machine_t mach)
return 1;
}
str = mu_sieve_string_raw (mach, &val->v.list, 0)->orig;
count = strtoul (str, &str, 10);
str = mu_str_skip_class (str, MU_CTYPE_DIGIT);
if (*str)
{
mu_diag_at_locus (MU_LOG_ERROR, &mach->locus,
......
......@@ -181,13 +181,6 @@ mu_sieve_reclaim_default (void *p)
free (p);
}
void
mu_sieve_reclaim_list (void *p)
{
mu_list_t list = p;
mu_list_destroy (&list);
}
void
mu_sieve_reclaim_value (void *p)
{
......
......@@ -29,7 +29,6 @@ typedef union
mu_sieve_handler_t handler;
mu_sieve_value_t *val;
mu_sieve_comparator_t comp;
mu_list_t list;
long number;
size_t pc;
size_t line;
......@@ -69,10 +68,10 @@ struct mu_sieve_machine
/* Symbol space: */
mu_opool_t string_pool; /* String constants */
mu_list_t source_list; /* Source names (for diagnostics) */
mu_list_t test_list; /* Tests */
mu_list_t action_list; /* Actions */
mu_list_t comp_list; /* Comparators */
mu_list_t source_list; /* Source names (for diagnostics) */
mu_sieve_string_t *stringspace;
size_t stringcount;
......@@ -86,7 +85,7 @@ struct mu_sieve_machine
sieve_op_t *prog; /* Compiled program */
/* Runtime data */
enum mu_sieve_state state;
enum mu_sieve_state state; /* Machine state */
size_t pc; /* Current program counter */
long reg; /* Numeric register */
mu_list_t stack; /* Runtime stack */
......@@ -144,8 +143,6 @@ struct mu_sieve_node
struct mu_locus_range locus;
union
{
mu_sieve_value_t *value;
mu_list_t list;
struct mu_sieve_node *node;
struct
{
......@@ -176,9 +173,6 @@ extern mu_sieve_machine_t mu_sieve_machine;
void mu_i_sv_code (struct mu_sieve_machine *mach, sieve_op_t op);
void mu_i_sv_compile_error (struct mu_sieve_machine *mach,
const char *fmt, ...) MU_PRINTFLIKE(2,3);
int mu_i_sv_locus (struct mu_sieve_machine *mach, struct mu_locus_range *lr);
void mu_i_sv_code_action (struct mu_sieve_machine *mach,
struct mu_sieve_node *node);
......@@ -203,9 +197,6 @@ void mu_i_sv_register_standard_actions (mu_sieve_machine_t mach);
void mu_i_sv_register_standard_tests (mu_sieve_machine_t mach);
void mu_i_sv_register_standard_comparators (mu_sieve_machine_t mach);
void mu_i_sv_print_value_list (mu_list_t list, mu_stream_t str);
void mu_i_sv_print_tag_list (mu_list_t list, mu_stream_t str);
void mu_i_sv_error (mu_sieve_machine_t mach);
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,
char const *what);
void mu_i_sv_trace (mu_sieve_machine_t mach, const char *what);
void mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str, mu_sieve_value_t *val);
void mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str,
mu_sieve_value_t *val);
typedef int (*mu_i_sv_interp_t) (char const *, size_t, char **, void *);
......
......@@ -547,10 +547,6 @@ mu_i_sv_valf (mu_sieve_machine_t mach, mu_stream_t str, mu_sieve_value_t *val)
mu_stream_printf (str, ":%s", val->v.string);
break;
case SVT_IDENT:
mu_stream_printf (str, "%s", val->v.string);
break;
default:
abort ();
}
......
......@@ -59,7 +59,6 @@ mu_sieve_value_create (mu_sieve_machine_t mach, mu_sieve_data_type type,
break;
case SVT_TAG:
case SVT_IDENT:
val->v.string = data;
break;
......@@ -142,7 +141,6 @@ mu_sieve_value_get (mu_sieve_machine_t mach, mu_sieve_value_t *val,
break;
case SVT_TAG:
case SVT_IDENT:
*(char**) ret = val->v.string;
break;
......@@ -237,9 +235,6 @@ mu_sieve_type_str (mu_sieve_data_type type)
case SVT_TAG:
return "tag";
case SVT_IDENT:
return "ident";
}
return "unknown";
......