From: Michael Tremer Date: Sat, 12 Oct 2024 17:15:08 +0000 (+0000) Subject: pakfire: Simplify storing features X-Git-Tag: 0.9.30~1063 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4158af21c33f7c1ec945ce2e4ed67c74bdef19d7;p=people%2Fms%2Fpakfire.git pakfire: Simplify storing features We don't need a struct here because we only store a list of strings. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index 1870084d4..b443e0a80 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -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; }