]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser-conf.c
discover: Allow discover server to receive boot messages
[petitboot] / discover / parser-conf.c
index a21efc4aced845e10fec38469e9abcc72bc85ed9..be19932c68c566dac92b9f915d3ec2680613dc4c 100644 (file)
@@ -155,6 +155,9 @@ void conf_init_global_options(struct conf_context *conf)
 {
        int i;
 
 {
        int i;
 
+       if (!conf->global_options)
+               return;
+
        for (i = 0; conf->global_options[i].name; i++)
                conf->global_options[i].value = NULL;
 }
        for (i = 0; conf->global_options[i].name; i++)
                conf->global_options[i].value = NULL;
 }
@@ -171,6 +174,8 @@ int conf_set_global_option(struct conf_context *conf, const char *name,
 {
        int i;
 
 {
        int i;
 
+       assert(conf->global_options);
+
        for (i = 0; conf->global_options[i].name; i++) {
                if (streq(name, conf->global_options[i].name)) {
                        conf->global_options[i].value
        for (i = 0; conf->global_options[i].name; i++) {
                if (streq(name, conf->global_options[i].name)) {
                        conf->global_options[i].value
@@ -196,6 +201,8 @@ const char *conf_get_global_option(struct conf_context *conf,
 {
        int i;
 
 {
        int i;
 
+       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,
        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,
@@ -217,8 +224,11 @@ static void conf_parse_buf(struct conf_context *conf)
 {
        char *pos, *name, *value;
 
 {
        char *pos, *name, *value;
 
+       assert(conf->get_pair);
+       assert(conf->process_pair);
+
        for (pos = conf->buf; pos;) {
        for (pos = conf->buf; pos;) {
-               pos = conf_get_pair_equal(conf, pos, &name, &value, '\n');
+               pos = conf->get_pair(conf, pos, &name, &value, '\n');
 
                if (!value)
                        continue;
 
                if (!value)
                        continue;