From 79a603758d3b46fa05a4588f0ca19648fa3601d6 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 11 May 2018 01:22:49 +0900 Subject: [PATCH] core: send NULL instead of empty string --- src/core/dbus-execute.c | 2 +- src/core/dbus-manager.c | 2 +- src/core/dbus-unit.c | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 23b98027d3..ff2dfa59d3 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -312,7 +312,7 @@ static int property_get_empty_string( assert(bus); assert(reply); - return sd_bus_message_append(reply, "s", ""); + return sd_bus_message_append(reply, "s", NULL); } static int property_get_syscall_filter( diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index de6aaba229..ced5d06bd4 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -99,7 +99,7 @@ static int property_get_virtualization( return sd_bus_message_append( reply, "s", - v == VIRTUALIZATION_NONE ? "" : virtualization_to_string(v)); + v == VIRTUALIZATION_NONE ? NULL : virtualization_to_string(v)); } static int property_get_architecture( diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 4d168b240d..f93893c62f 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -81,7 +81,7 @@ static int property_get_following( assert(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( @@ -235,7 +235,7 @@ static int property_get_unit_file_preset( r = unit_get_unit_file_preset(u); return sd_bus_message_append(reply, "s", - r < 0 ? "": + r < 0 ? NULL: r > 0 ? "enabled" : "disabled"); } @@ -918,7 +918,7 @@ static int property_get_cgroup( sd_bus_error *error) { Unit *u = userdata; - const char *t; + const char *t = NULL; assert(bus); assert(reply); @@ -932,8 +932,6 @@ static int property_get_cgroup( if (u->cgroup_path) t = isempty(u->cgroup_path) ? "/" : u->cgroup_path; - else - t = ""; return sd_bus_message_append(reply, "s", t); }