diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-14 16:55:36 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-14 16:55:36 +0100 |
commit | 4ce9dbece67d8497ea2b703d6e966aba71aceb18 (patch) | |
tree | f1e6edff93dfbc72f0db1991b80d0400b6ae3fef /src/libutil | |
parent | 0d4212eb6cf416c2c02a030195462993bdc84fea (diff) | |
download | rspamd-4ce9dbece67d8497ea2b703d6e966aba71aceb18.tar.gz rspamd-4ce9dbece67d8497ea2b703d6e966aba71aceb18.zip |
[Minor] Add glob_multi map type
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/map_helpers.c | 25 | ||||
-rw-r--r-- | src/libutil/map_helpers.h | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/libutil/map_helpers.c b/src/libutil/map_helpers.c index c43c23277..bf18102d8 100644 --- a/src/libutil/map_helpers.c +++ b/src/libutil/map_helpers.c @@ -1027,6 +1027,30 @@ rspamd_regexp_list_read_multiple ( struct rspamd_regexp_map_helper *re_map; if (data->cur_data == NULL) { + re_map = rspamd_map_helper_new_regexp (data->map, + RSPAMD_REGEXP_MAP_FLAG_GLOB|RSPAMD_REGEXP_MAP_FLAG_MULTIPLE); + data->cur_data = re_map; + } + + return rspamd_parse_kv_list ( + chunk, + len, + data, + rspamd_map_helper_insert_re, + hash_fill, + final); +} + +gchar * +rspamd_glob_list_read_multiple ( + gchar *chunk, + gint len, + struct map_cb_data *data, + gboolean final) +{ + struct rspamd_regexp_map_helper *re_map; + + if (data->cur_data == NULL) { re_map = rspamd_map_helper_new_regexp (data->map, RSPAMD_REGEXP_MAP_FLAG_MULTIPLE); data->cur_data = re_map; } @@ -1040,6 +1064,7 @@ rspamd_regexp_list_read_multiple ( final); } + void rspamd_regexp_list_fin (struct map_cb_data *data) { diff --git a/src/libutil/map_helpers.h b/src/libutil/map_helpers.h index 28a5e336b..f7c86436f 100644 --- a/src/libutil/map_helpers.h +++ b/src/libutil/map_helpers.h @@ -80,11 +80,17 @@ gchar * rspamd_regexp_list_read_multiple ( gint len, struct map_cb_data *data, gboolean final); + gchar * rspamd_glob_list_read_single ( gchar *chunk, gint len, struct map_cb_data *data, gboolean final); +gchar * rspamd_glob_list_read_multiple ( + gchar *chunk, + gint len, + struct map_cb_data *data, + gboolean final); void rspamd_regexp_list_fin (struct map_cb_data *data); void rspamd_regexp_list_dtor (struct map_cb_data *data); |