]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Simplify storing features
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2024 17:15:08 +0000 (17:15 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2024 17:15:08 +0000 (17:15 +0000)
We don't need a struct here because we only store a list of strings.

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

index 1870084d45cfeb8d09c0cad2652e98f5f52a3269..b443e0a80ed63ce1cf5c49d2e108f640d86ba45d 100644 (file)
@@ -112,33 +112,31 @@ struct pakfire {
 /*
        This is a list of all features that are supported by this version of Pakfire
 */
-static const struct pakfire_feature {
-       const char* name;
-} features[] = {
-       { "RichDependencies" },
+static const char* features[] = {
+       "RichDependencies",
 
        // Package Formats
-       { "PackageFormat-6" },
-       { "PackageFormat-5" },
+       "PackageFormat-6",
+       "PackageFormat-5",
 
        // Compression
-       { "Compress-XZ" },
-       { "Compress-Zstandard" },
+       "Compress-XZ",
+       "Compress-Zstandard",
 
        // Digests
-       { "Digest-BLAKE2b512" },
-       { "Digest-BLAKE2s256" },
-       { "Digest-SHA3-512" },
-       { "Digest-SHA3-256" },
-       { "Digest-SHA2-512" },
-       { "Digest-SHA2-256" },
+       "Digest-BLAKE2b512",
+       "Digest-BLAKE2s256",
+       "Digest-SHA3-512",
+       "Digest-SHA3-256",
+       "Digest-SHA2-512",
+       "Digest-SHA2-256",
 
        // Systemd
-       { "systemd-sysusers" },
-       { "systemd-tmpfiles" },
+       "systemd-sysusers",
+       "systemd-tmpfiles",
 
        // The end
-       { NULL },
+       NULL,
 };
 
 int pakfire_on_root(struct pakfire* pakfire) {
@@ -209,8 +207,8 @@ static void pool_log(Pool* pool, void* data, int type, const char* s) {
 
 static Id pakfire_handle_ns_pakfire(struct pakfire* pakfire, const char* name) {
        // Find all supported features
-       for (const struct pakfire_feature* feature = features; feature->name; feature++) {
-               if (strcmp(feature->name, name) == 0)
+       for (const char** feature = features; *feature; feature++) {
+               if (strcmp(*feature, name) == 0)
                        return 1;
        }