X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fparser-conf.c;h=5f2b9787303d3102033662f08cf2477c23a78b60;hp=94612c326a6cdd35332443b1f5846878eafdd4fd;hb=d63bacef37d61b46e8db10914d4a7a677ba0775a;hpb=06a49ebdfc795a70b938f5aee29f3c488ef9fc21 diff --git a/discover/parser-conf.c b/discover/parser-conf.c index 94612c3..5f2b978 100644 --- a/discover/parser-conf.c +++ b/discover/parser-conf.c @@ -16,7 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define _GNU_SOURCE +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif #include #include @@ -46,6 +48,9 @@ char *conf_strip_str(char *s) if (!s) return NULL; + if (!strlen(s)) + return NULL; + while (*s == '"' || *s == '\'' || isspace(*s)) s++; @@ -124,8 +129,6 @@ char *conf_get_pair(struct conf_context __attribute__((unused)) *conf, char *str } exit: - pb_log("%s: @%s@%s@\n", __func__, *name_out, *value_out); - return end ? end + 1 : NULL; } @@ -180,7 +183,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_debug("%s: %s = '%s'\n", __func__, name, value); return 1; } } @@ -204,11 +207,8 @@ const char *conf_get_global_option(struct conf_context *conf, assert(conf->global_options); for (i = 0; conf->global_options[i].name ;i++) - if (streq(name, conf->global_options[i].name)) { - pb_log("%s: @%s@%s@\n", __func__, name, - conf->global_options[i].value); + if (streq(name, conf->global_options[i].name)) return conf->global_options[i].value; - } assert(0 && "unknown global name"); return NULL;