]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser.c
logging: Clean up debug logs
[petitboot] / discover / parser.c
index b0668808cd859cfe7706ad5df870005878639a4e..7b701181811d4f358b777b2ea2ea8394c431f95b 100644 (file)
@@ -140,7 +140,7 @@ void iterate_parsers(struct discover_context *ctx, enum conf_method method)
                        if (i->parser->method != CONF_METHOD_LOCAL_FILE)
                                continue;
 
-                       pb_log("\ttrying parser '%s'\n", i->parser->name);
+                       pb_debug("\ttrying parser '%s'\n", i->parser->name);
                        ctx->parser = i->parser;
                        iterate_parser_files(ctx, ctx->parser);
                }
@@ -158,7 +158,7 @@ void iterate_parsers(struct discover_context *ctx, enum conf_method method)
                        if (i->parser->method != method)
                                continue;
 
-                       pb_log("\ttrying parser '%s'\n", i->parser->name);
+                       pb_debug("\ttrying parser '%s'\n", i->parser->name);
                        ctx->parser = i->parser;
                        i->parser->parse(ctx, buf, len);
                }
@@ -171,14 +171,25 @@ void iterate_parsers(struct discover_context *ctx, enum conf_method method)
        }
 }
 
+static void *parsers_ctx;
+
 void __register_parser(struct parser *parser)
 {
-       struct p_item* i = talloc(NULL, struct p_item);
+       struct p_item *i;
+
+       if (!parsers_ctx)
+               parsers_ctx = talloc_new(NULL);
 
+       i = talloc(parsers_ctx, struct p_item);
        i->parser = parser;
        list_add(&parsers, &i->list);
 }
 
+static __attribute__((destructor)) void cleanup_parsers(void)
+{
+       talloc_free(parsers_ctx);
+}
+
 void parser_init(void)
 {
 }