PakfireParser pakfire_parser_merge(PakfireParser parser1, PakfireParser parser2);
int pakfire_parser_read(PakfireParser parser, FILE* f);
+char* pakfire_parser_dump(PakfireParser parser);
#ifdef PAKFIRE_PRIVATE
return r;
}
+
+PAKFIRE_EXPORT char* pakfire_parser_dump(PakfireParser parser) {
+ char* s = NULL;
+
+ for (unsigned int i = 0; i < parser->num_declarations; i++) {
+ struct pakfire_parser_declaration* d = parser->declarations[i];
+
+ if (d) {
+ if (s)
+ asprintf(&s, "%s%-24s = %s\n", s, d->name, d->value);
+ else
+ asprintf(&s, "%-24s = %s\n", d->name, d->value);
+ }
+ }
+
+ return s;
+}
}
int pakfire_parser_parse_data(PakfireParser parent, const char* data, size_t len) {
- Pakfire pakfire = pakfire_parser_get_pakfire(parser);
+ Pakfire pakfire = pakfire_parser_get_pakfire(parent);
DEBUG(pakfire, "Parsing the following data:\n%s\n", data);
parent = pakfire_parser_merge(parent, parser);
}
- pakfire_unref(pakfire);
+ // Destroy the parser
pakfire_parser_unref(parser);
+ // Log what we have in the parent parser now
+ char* dump = pakfire_parser_dump(parent);
+
+ DEBUG(pakfire, "Status of the parser %p:\n%s\n", parent, dump);
+ pakfire_free(dump);
+
+ // Cleanup
+ pakfire_unref(pakfire);
+
return r;
}