+
+out_clean:
+ if (result->cleanup_local)
+ unlink(result->local);
+out:
+ return -1;
+}
+
+void iterate_parsers(struct discover_context *ctx)
+{
+ struct p_item* i;
+
+ pb_log("trying parsers for %s\n", ctx->device->device->id);
+
+ list_for_each_entry(&parsers, i, list) {
+ pb_debug("\ttrying parser '%s'\n", i->parser->name);
+ ctx->parser = i->parser;
+ i->parser->parse(ctx);
+ }
+ ctx->parser = NULL;
+}
+
+static void *parsers_ctx;
+
+void __register_parser(struct parser *parser)
+{
+ 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);