From 8a9b38112dc61b21885a4b9de151cbc9fcaf2064 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 11 Jan 2025 14:26:36 +0000 Subject: [PATCH] parser: Simplify declaration matching Signed-off-by: Michael Tremer --- src/pakfire/parser.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pakfire/parser.c b/src/pakfire/parser.c index 31dd8cebe..3198202e5 100644 --- a/src/pakfire/parser.c +++ b/src/pakfire/parser.c @@ -195,14 +195,19 @@ static struct pakfire_parser_declaration* pakfire_parser_get_declaration( if (!d) break; - // Return if namespace and name match - if ((strcmp(d->namespace, namespace) == 0) && (strcmp(d->name, name) == 0)) { + // Skip if namespace does not match + if (!pakfire_string_equals(d->namespace, namespace)) + continue; + + // Skip if name does not match + else if (!pakfire_string_equals(d->name, name)) + continue; + #ifdef PAKFIRE_DEBUG_PARSER - DEBUG(parser->ctx, "%p: Found result = %s\n", parser, d->value); + DEBUG(parser->ctx, "%p: Found result = %s\n", parser, d->value); #endif /* PAKFIRE_DEBUG_PARSER */ - return d; - } + return d; } #ifdef PAKFIRE_DEBUG_PARSER -- 2.47.3