struct pakfire_parser* parent;
int flags;
- char* namespace;
+
+ // Namespace
+ char namespace[NAME_MAX];
struct pakfire_parser_declaration** declarations;
size_t num_declarations;
static void pakfire_parser_free(struct pakfire_parser* parser) {
pakfire_parser_free_declarations(parser);
- if (parser->namespace)
- free(parser->namespace);
-
if (parser->parent)
pakfire_parser_unref(parser->parent);
if (parser->pakfire)
}
int pakfire_parser_set_namespace(struct pakfire_parser* parser, const char* namespace) {
- if (parser->namespace)
- free(parser->namespace);
+ int r;
- if (namespace)
- parser->namespace = strdup(namespace);
- else
- parser->namespace = NULL;
+ // Store the namespace
+ r = pakfire_string_set(parser->namespace, namespace);
+ if (r < 0)
+ return r;
DEBUG(parser->ctx, "%p: Set namespace to: %s\n", parser, parser->namespace);