]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: use empty_to_null() where we can 7573/head
authorLennart Poettering <lennart@poettering.net>
Thu, 7 Dec 2017 11:13:00 +0000 (12:13 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Dec 2017 11:13:00 +0000 (12:13 +0100)
coccinelle/empty-to-null.cocci [new file with mode: 0644]
src/core/unit.c

diff --git a/coccinelle/empty-to-null.cocci b/coccinelle/empty-to-null.cocci
new file mode 100644 (file)
index 0000000..fbc75b9
--- /dev/null
@@ -0,0 +1,5 @@
+@@
+expression s;
+@@
+- isempty(s) ? NULL : s
++ empty_to_null(s)
index ed0cf026785cd2aeab81bc8e89291fe52d270b1e..7af8425707e12c1def98e0afdd5555b573c2d93c 100644 (file)
@@ -3015,8 +3015,8 @@ static int signal_name_owner_changed(sd_bus_message *message, void *userdata, sd
                 return 0;
         }
 
-        old_owner = isempty(old_owner) ? NULL : old_owner;
-        new_owner = isempty(new_owner) ? NULL : new_owner;
+        old_owner = empty_to_null(old_owner);
+        new_owner = empty_to_null(new_owner);
 
         if (UNIT_VTABLE(u)->bus_name_owner_change)
                 UNIT_VTABLE(u)->bus_name_owner_change(u, name, old_owner, new_owner);