]> git.ipfire.org Git - pakfire.git/commitdiff
file: Pass NULL to set function when setting hard/symlinks
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 31 Aug 2022 12:52:40 +0000 (12:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 31 Aug 2022 12:52:40 +0000 (12:52 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/file.c

index 0f9020ba51a6f07add98620f4a3bce862c5ce605..2fe7195b7b4121796c5c61882c130fc306c3508a 100644 (file)
@@ -416,10 +416,7 @@ PAKFIRE_EXPORT const char* pakfire_file_get_hardlink(struct pakfire_file* file)
 }
 
 PAKFIRE_EXPORT void pakfire_file_set_hardlink(struct pakfire_file* file, const char* link) {
-       if (!link || !*link)
-               *file->hardlink = '\0';
-       else
-               pakfire_string_set(file->hardlink, link);
+       pakfire_string_set(file->hardlink, link);
 }
 
 PAKFIRE_EXPORT const char* pakfire_file_get_symlink(struct pakfire_file* file) {
@@ -430,10 +427,7 @@ PAKFIRE_EXPORT const char* pakfire_file_get_symlink(struct pakfire_file* file) {
 }
 
 PAKFIRE_EXPORT void pakfire_file_set_symlink(struct pakfire_file* file, const char* link) {
-       if (!link || !*link)
-               *file->hardlink = '\0';
-       else
-               pakfire_string_set(file->symlink, link);
+       pakfire_string_set(file->symlink, link);
 }
 
 PAKFIRE_EXPORT int pakfire_file_get_type(struct pakfire_file* file) {