}
}
-static PakfireParser make_if_stmt(Pakfire pakfire, PakfireParser parser, const enum operator op,
+static PakfireParser make_if_stmt(Pakfire pakfire, const enum operator op,
const char* val1, const char* val2, PakfireParser if_block, PakfireParser else_block);
static int pakfire_parser_new_declaration(
if_stmt : T_IF T_STRING T_EQUALS T_STRING T_EOL subgrammar else_stmt T_END T_EOL
{
- $$ = make_if_stmt(pakfire, parent, OP_EQUALS, $2, $4, $6, $7);
+ $$ = make_if_stmt(pakfire, OP_EQUALS, $2, $4, $6, $7);
if ($6)
pakfire_parser_unref($6);
return r;
}
-static PakfireParser make_if_stmt(Pakfire pakfire, PakfireParser parser, const enum operator op,
+static PakfireParser make_if_stmt(Pakfire pakfire, const enum operator op,
const char* val1, const char* val2, PakfireParser if_block, PakfireParser else_block) {
switch (op) {
case OP_EQUALS:
break;
}
- DEBUG(pakfire, " parent = %p, if = %p, else = %p\n", parser, if_block, else_block);
+ PakfireParser parent = pakfire_parser_get_parent(if_block);
+
+ DEBUG(pakfire, " parent = %p, if = %p, else = %p\n", parent, if_block, else_block);
// Expand values
- char* v1 = pakfire_parser_expand(parser, NULL, val1);
- char* v2 = pakfire_parser_expand(parser, NULL, val2);
+ char* v1 = pakfire_parser_expand(parent, NULL, val1);
+ char* v2 = pakfire_parser_expand(parent, NULL, val2);
PakfireParser result = NULL;
free(v1);
free(v2);
+ pakfire_parser_unref(parent);
if (result)
pakfire_parser_ref(result);