diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2009-07-09 10:40:44 -0700 |
---|---|---|
committer | Geoff Levand <geoffrey.levand@am.sony.com> | 2009-07-09 10:40:44 -0700 |
commit | 3f82d6fc10a582ba3f558b69c14ab4ab7234e5ea (patch) | |
tree | b117b124cff9bc86045a49cf2a68bf9746cdda54 /discover/parser-conf.c | |
parent | 4d31064a2a8ad030a1bffc75d5a7b6e2407c350a (diff) | |
download | talos-petitboot-3f82d6fc10a582ba3f558b69c14ab4ab7234e5ea.tar.gz talos-petitboot-3f82d6fc10a582ba3f558b69c14ab4ab7234e5ea.zip |
Zero parser globals before use
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Diffstat (limited to 'discover/parser-conf.c')
-rw-r--r-- | discover/parser-conf.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/discover/parser-conf.c b/discover/parser-conf.c index 14f847d..88e96b7 100644 --- a/discover/parser-conf.c +++ b/discover/parser-conf.c @@ -121,6 +121,18 @@ int conf_param_in_list(const char *const *list, const char *param) } /** + * conf_init_global_options - Zero the global option table. + */ + +void conf_init_global_options(struct conf_context *conf) +{ + int i; + + for (i = 0; conf->global_options[i].name; i++) + conf->global_options[i].value = NULL; +} + +/** * conf_set_global_option - Set a value in the global option table. * * Check if an option (name=value) is a global option. If so, store it in @@ -136,7 +148,7 @@ int conf_set_global_option(struct conf_context *conf, const char *name, if (streq(name, conf->global_options[i].name)) { conf->global_options[i].value = talloc_strdup(conf, value); - pb_log("%s: %s:%s\n", __func__, name, value); + pb_log("%s: @%s@%s@\n", __func__, name, value); return 1; } } @@ -158,8 +170,11 @@ const char *conf_get_global_option(struct conf_context *conf, int i; for (i = 0; conf->global_options[i].name ;i++) - if (streq(name, conf->global_options[i].name)) + if (streq(name, conf->global_options[i].name)) { + pb_log("%s: @%s@%s@\n", __func__, name, + conf->global_options[i].value); return conf->global_options[i].value; + } assert(0 && "unknown global name"); return NULL; |