core: send NULL instead of empty string

This commit is contained in:
Yu Watanabe 2018-05-11 01:22:49 +09:00
parent 9d5527f26e
commit 79a603758d
3 changed files with 5 additions and 7 deletions

View file

@ -312,7 +312,7 @@ static int property_get_empty_string(
assert(bus); assert(bus);
assert(reply); assert(reply);
return sd_bus_message_append(reply, "s", ""); return sd_bus_message_append(reply, "s", NULL);
} }
static int property_get_syscall_filter( static int property_get_syscall_filter(

View file

@ -99,7 +99,7 @@ static int property_get_virtualization(
return sd_bus_message_append( return sd_bus_message_append(
reply, "s", reply, "s",
v == VIRTUALIZATION_NONE ? "" : virtualization_to_string(v)); v == VIRTUALIZATION_NONE ? NULL : virtualization_to_string(v));
} }
static int property_get_architecture( static int property_get_architecture(

View file

@ -81,7 +81,7 @@ static int property_get_following(
assert(u); assert(u);
f = unit_following(u); f = unit_following(u);
return sd_bus_message_append(reply, "s", f ? f->id : ""); return sd_bus_message_append(reply, "s", f ? f->id : NULL);
} }
static int property_get_dependencies( static int property_get_dependencies(
@ -235,7 +235,7 @@ static int property_get_unit_file_preset(
r = unit_get_unit_file_preset(u); r = unit_get_unit_file_preset(u);
return sd_bus_message_append(reply, "s", return sd_bus_message_append(reply, "s",
r < 0 ? "": r < 0 ? NULL:
r > 0 ? "enabled" : "disabled"); r > 0 ? "enabled" : "disabled");
} }
@ -918,7 +918,7 @@ static int property_get_cgroup(
sd_bus_error *error) { sd_bus_error *error) {
Unit *u = userdata; Unit *u = userdata;
const char *t; const char *t = NULL;
assert(bus); assert(bus);
assert(reply); assert(reply);
@ -932,8 +932,6 @@ static int property_get_cgroup(
if (u->cgroup_path) if (u->cgroup_path)
t = isempty(u->cgroup_path) ? "/" : u->cgroup_path; t = isempty(u->cgroup_path) ? "/" : u->cgroup_path;
else
t = "";
return sd_bus_message_append(reply, "s", t); return sd_bus_message_append(reply, "s", t);
} }