summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/test-bus-server.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-05 13:11:26 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-05 13:12:11 +0200
commitc784c5ce777f16ee56086a072dc1466639bc9eff (patch)
tree4d092bb8f0d6a8386f29f10ccc9174be47a15723 /src/libsystemd-bus/test-bus-server.c
parent1e64bbc15671db861c811bdf63014eee826a6eca (diff)
bus: use C99 struct construction for error initializers
That way we can allocate an error struct on-the-fly while calling a function. Nice!
Diffstat (limited to 'src/libsystemd-bus/test-bus-server.c')
-rw-r--r--src/libsystemd-bus/test-bus-server.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd-bus/test-bus-server.c b/src/libsystemd-bus/test-bus-server.c
index a594ce3157..a9772624f2 100644
--- a/src/libsystemd-bus/test-bus-server.c
+++ b/src/libsystemd-bus/test-bus-server.c
@@ -96,9 +96,10 @@ static void *server(void *p) {
quit = true;
} else if (sd_bus_message_is_method_call(m, NULL, NULL)) {
- const sd_bus_error e = SD_BUS_ERROR_INIT_CONST("org.freedesktop.DBus.Error.UnknownMethod", "Unknown method.");
-
- r = sd_bus_message_new_method_error(bus, m, &e, &reply);
+ r = sd_bus_message_new_method_error(
+ bus, m,
+ &SD_BUS_ERROR_MAKE("org.freedesktop.DBus.Error.UnknownMethod", "Unknown method."),
+ &reply);
if (r < 0) {
log_error("Failed to allocate return: %s", strerror(-r));
goto fail;
@@ -128,7 +129,7 @@ fail:
static int client(struct context *c) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
_cleanup_bus_unref_ sd_bus *bus = NULL;
- sd_bus_error error = SD_BUS_ERROR_INIT;
+ sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
assert_se(sd_bus_new(&bus) >= 0);