From ecd48322c2fd11ccdeed971c45c611f001d0d7b8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 26 Oct 2017 17:26:27 +0200 Subject: [PATCH] core: sd-bus can handle NULL strings nicely, let's use it No need to set an empty string here, sd-bus serializes NULL as empty string anway. --- src/core/dbus-mount.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c index c683b36c4c..69a04fe2ae 100644 --- a/src/core/dbus-mount.c +++ b/src/core/dbus-mount.c @@ -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); }