On Wed, 2011-03-30 at 14:02 +0200, Nikola Pajkovsky wrote:
Signed-off-by: Nikola Pajkovsky npajkovs@redhat.com
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 72b1d8c..8dcfb9f 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 a84aae0..7a8b5e3 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;
+}
Looks good to me.