]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
parser: Simplify declaration matching
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Jan 2025 14:26:36 +0000 (14:26 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Jan 2025 14:26:36 +0000 (14:26 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/parser.c

index 31dd8cebebd80226019cfb92e1b7d0752059e914..3198202e58c0006e91744b3663e104beb03553c4 100644 (file)
@@ -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