]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
package: Simply empty string check
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 May 2022 17:34:16 +0000 (17:34 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 May 2022 17:34:16 +0000 (17:34 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/package.c

index d5634a8f8497177da27749303681d3e00237106e..1afbba18d00ac5d118efdd91259f4375e1cb9f59 100644 (file)
@@ -316,16 +316,13 @@ static void pakfire_package_set_num(struct pakfire_package* pkg, Id type, unsign
        solvable_set_num(s, type, value);
 }
 
-static const char* pakfire_package_get_string(struct pakfire_package* pkg, int key) {
+static const char* pakfire_package_get_string(struct pakfire_package* pkg, Id key) {
        pakfire_package_internalize_repo(pkg);
 
        Solvable* s = get_solvable(pkg);
-       const char* str = solvable_lookup_str(s, key);
-
-       if (!str)
-               return NULL;
 
-       if (strlen(str) == 0)
+       const char* str = solvable_lookup_str(s, key);
+       if (!str || !*str)
                return NULL;
 
        return str;