]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: sd-bus can handle NULL strings nicely, let's use it
authorLennart Poettering <lennart@poettering.net>
Thu, 26 Oct 2017 15:26:27 +0000 (17:26 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 12 Nov 2017 13:27:19 +0000 (14:27 +0100)
No need to set an empty string here, sd-bus serializes NULL as empty
string anway.

src/core/dbus-mount.c

index c683b36c4c1448560b06c8b66d00b64b846bbad2..69a04fe2ae30647da8af2a95781ceb0424133f84 100644 (file)
@@ -36,7 +36,7 @@ static int property_get_what(
                 sd_bus_error *error) {
 
         Mount *m = userdata;
-        const char *d;
+        const char *d = NULL;
 
         assert(bus);
         assert(reply);
@@ -46,8 +46,6 @@ static int property_get_what(
                 d = m->parameters_proc_self_mountinfo.what;
         else if (m->from_fragment && m->parameters_fragment.what)
                 d = m->parameters_fragment.what;
-        else
-                d = "";
 
         return sd_bus_message_append(reply, "s", d);
 }
@@ -62,7 +60,7 @@ static int property_get_options(
                 sd_bus_error *error) {
 
         Mount *m = userdata;
-        const char *d;
+        const char *d = NULL;
 
         assert(bus);
         assert(reply);
@@ -72,8 +70,6 @@ static int property_get_options(
                 d = m->parameters_proc_self_mountinfo.options;
         else if (m->from_fragment && m->parameters_fragment.options)
                 d = m->parameters_fragment.options;
-        else
-                d = "";
 
         return sd_bus_message_append(reply, "s", d);
 }