From b21745640ee0852ce0cdc3f430371769a60d9317 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Wed, 30 Mar 2011 13:40:45 +0200 Subject: make validate_event_option static Signed-off-by: Nikola Pajkovsky --- src/include/report/event_config.h | 1 - src/lib/event_config.c | 54 +++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/include/report/event_config.h b/src/include/report/event_config.h index 72b1d8c1..8dcfb9f6 100644 --- a/src/include/report/event_config.h +++ b/src/include/report/event_config.h @@ -90,7 +90,6 @@ GList *export_event_config(const char *event_name); void unexport_event_config(GList *env_list); GHashTable *validate_event(const char *event_name); -char *validate_event_option(event_option_t *opt); #ifdef __cplusplus } diff --git a/src/lib/event_config.c b/src/lib/event_config.c index a84aae0c..7a8b5e31 100644 --- a/src/lib/event_config.c +++ b/src/lib/event_config.c @@ -284,34 +284,8 @@ void unexport_event_config(GList *env_list) } } -GHashTable *validate_event(const char *event_name) -{ - event_config_t *config = get_event_config(event_name); - if (!config) - return NULL; - - - GHashTable *errors = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); - GList *li; - - for (li = config->options; li; li = li->next) - { - event_option_t *opt = (event_option_t *)li->data; - char *err = validate_event_option(opt); - if (err) - g_hash_table_insert(errors, xstrdup(opt->name), err); - } - - if (g_hash_table_size(errors)) - return errors; - - g_hash_table_destroy(errors); - - return NULL; -} - /* return NULL if successful otherwise appropriate error message */ -char *validate_event_option(event_option_t *opt) +static char *validate_event_option(event_option_t *opt) { if (!opt->allow_empty && (!opt->value || !opt->value[0])) return xstrdup(_("Missing mandatory value")); @@ -353,3 +327,29 @@ char *validate_event_option(event_option_t *opt) return NULL; } + +GHashTable *validate_event(const char *event_name) +{ + event_config_t *config = get_event_config(event_name); + if (!config) + return NULL; + + + GHashTable *errors = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); + GList *li; + + for (li = config->options; li; li = li->next) + { + event_option_t *opt = (event_option_t *)li->data; + char *err = validate_event_option(opt); + if (err) + g_hash_table_insert(errors, xstrdup(opt->name), err); + } + + if (g_hash_table_size(errors)) + return errors; + + g_hash_table_destroy(errors); + + return NULL; +} -- cgit