From 9a8f854b5bc2279a8d2ee6ff3bac362dac635372 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 23 Apr 2012 18:47:21 +0400 Subject: [PATCH] Add basic list config parser. --- src/cfg_xml.c | 12 ++++++++++++ src/cfg_xml.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/cfg_xml.c b/src/cfg_xml.c index c700a0366..924dc283e 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -1537,6 +1537,18 @@ xml_handle_string_list (struct config_file *cfg, struct rspamd_xml_userdata *ctx return TRUE; } +gboolean +xml_handle_list (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset) +{ + /* Simply assign pointer to pointer */ + GList **dest; + + dest = (GList **)G_STRUCT_MEMBER_P (dest_struct, offset); + *dest = g_list_prepend (*dest, memory_pool_strdup (cfg->cfg_pool, data)); + + return TRUE; +} + gboolean xml_handle_size (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset) diff --git a/src/cfg_xml.h b/src/cfg_xml.h index 4e7f1481a..b78a74fd9 100644 --- a/src/cfg_xml.h +++ b/src/cfg_xml.h @@ -95,6 +95,9 @@ void rspamd_xml_error (GMarkupParseContext *context, gboolean xml_handle_string (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset); gboolean xml_handle_string_list (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset); +/* Handle glist attributes as strings */ +gboolean xml_handle_list (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset); + /* Numeric params */ gboolean xml_handle_size (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset); gboolean xml_handle_size_64 (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset); -- 2.39.5