summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------gint0
-rw-r--r--include/mailutils/sieve.h28
-rw-r--r--libmu_sieve/comparator.c3
-rw-r--r--libmu_sieve/mem.c7
-rw-r--r--libmu_sieve/sieve-priv.h16
-rw-r--r--libmu_sieve/sieve.y4
-rw-r--r--libmu_sieve/util.c5
7 files changed, 18 insertions, 45 deletions
diff --git a/gint b/gint
-Subproject fd86bf7d44b0c970771830692ae7491447ebe8b
+Subproject 42f4712085b40173eaea58e14b1a579291a6fe3
diff --git a/include/mailutils/sieve.h b/include/mailutils/sieve.h
index 7227abad8..aaffc9ff7 100644
--- a/include/mailutils/sieve.h
+++ b/include/mailutils/sieve.h
@@ -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 */
diff --git a/libmu_sieve/comparator.c b/libmu_sieve/comparator.c
index a0d5836d3..44dd05bbf 100644
--- a/libmu_sieve/comparator.c
+++ b/libmu_sieve/comparator.c
@@ -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,
diff --git a/libmu_sieve/mem.c b/libmu_sieve/mem.c
index 25dc26c5b..3c39a3d10 100644
--- a/libmu_sieve/mem.c
+++ b/libmu_sieve/mem.c
@@ -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)
{
diff --git a/libmu_sieve/sieve-priv.h b/libmu_sieve/sieve-priv.h
index 7ae2fdf5a..c1ebb15ce 100644
--- a/libmu_sieve/sieve-priv.h
+++ b/libmu_sieve/sieve-priv.h
@@ -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 *);
diff --git a/libmu_sieve/sieve.y b/libmu_sieve/sieve.y
index a76b3de91..0a54736e3 100644
--- a/libmu_sieve/sieve.y
+++ b/libmu_sieve/sieve.y
@@ -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 ();
}
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
index 9e46bda95..6716682b3 100644
--- a/libmu_sieve/util.c
+++ b/libmu_sieve/util.c
@@ -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";

Return to:

Send suggestions and report system problems to the System administrator.