]> git.ipfire.org Git - pakfire.git/commitdiff
arch: Null-terminate array
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Feb 2021 17:34:52 +0000 (17:34 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Feb 2021 17:34:52 +0000 (17:34 +0000)
This changes nothing apart from that the code looks similar to other
places.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/arch.c

index dd74145b7a3753b6ca2be61373a9aa594c14772d..03bf28dd57a6593a3fc9d7fd34021abb360831df 100644 (file)
@@ -93,14 +93,13 @@ static const struct pakfire_arch PAKFIRE_ARCHES[] = {
                .platform = "riscv",
                .personality = PER_LINUX,
        },
+
+       // The end
+       { NULL },
 };
 
 static const struct pakfire_arch* pakfire_arch_find(const char* name) {
-       const size_t length = sizeof(PAKFIRE_ARCHES) / sizeof(*PAKFIRE_ARCHES);
-
-       for (unsigned int i = 0; i < length; i++) {
-               const struct pakfire_arch* arch = &PAKFIRE_ARCHES[i];
-
+       for (const struct pakfire_arch* arch = PAKFIRE_ARCHES; arch->name; arch++) {
                if (strcmp(arch->name, name) == 0)
                        return arch;
        }