]> git.ipfire.org Git - pakfire.git/commitdiff
arch: Use our own string comparison function
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Jan 2025 10:47:37 +0000 (10:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Jan 2025 10:47:37 +0000 (10:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/arch.c

index e81ae2d227642f3133ffbe7331af40b554baf3e7..ef7ba083469c16d9f9129401625a3e4af391528d 100644 (file)
@@ -74,7 +74,7 @@ static const struct pakfire_arch PAKFIRE_ARCHES[] = {
 
 static const struct pakfire_arch* pakfire_arch_find(const char* name) {
        for (const struct pakfire_arch* arch = PAKFIRE_ARCHES; arch->name; arch++) {
-               if (strcmp(arch->name, name) == 0)
+               if (pakfire_string_equals(arch->name, name))
                        return arch;
        }
 
@@ -196,7 +196,7 @@ int pakfire_arch_is_compatible(const char* name, const char* compatible_arch) {
                return -EINVAL;
 
        // Every architecture is compatible with itself
-       if (strcmp(name, compatible_arch) == 0)
+       if (pakfire_string_equals(name, compatible_arch))
                return 1;
 
        const struct pakfire_arch* arch = pakfire_arch_find(name);
@@ -204,7 +204,7 @@ int pakfire_arch_is_compatible(const char* name, const char* compatible_arch) {
                return 0;
 
        for (unsigned int i = 0; arch->compatible[i]; i++) {
-               if (strcmp(arch->compatible[i], compatible_arch) == 0)
+               if (pakfire_string_equals(arch->compatible[i], compatible_arch))
                        return 1;
        }
 
@@ -224,7 +224,7 @@ static const char* pakfire_arch_is_natively_supported_by_host(const char* name)
        const char* native_arch = pakfire_arch_native();
 
        // All hosts support noarch natively
-       if (strcmp(name, "noarch") == 0)
+       if (pakfire_string_equals(name, "noarch"))
                return native_arch;
 
        // Check if those two architectures are compatible
@@ -285,7 +285,7 @@ static char* find_interpreter(DIR* dir, const char* path, const char* magic) {
                pakfire_string_rstrip(line);
 
                // Look for the "enabled" line
-               if (strcmp("enabled", line) == 0) {
+               if (pakfire_string_equals("enabled", line)) {
                        enabled = 1;
 
                // Store the interpreter for later
@@ -296,7 +296,7 @@ static char* find_interpreter(DIR* dir, const char* path, const char* magic) {
                } else if (pakfire_string_startswith(line, "magic ")) {
                        const char* m = line + strlen("magic ");
 
-                       if (strcmp(magic, m) == 0)
+                       if (pakfire_string_equals(magic, m))
                                match = 1;
                }
        }