1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00

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.
This commit is contained in:
Lennart Poettering 2017-10-26 17:26:27 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 3e3852b3c6
commit ecd48322c2

View 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);
}