chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-bus: fix marshaling of unary type
[elogind.git]
/
src
/
libelogind
/
sd-bus
/
test-bus-chat.c
diff --git
a/src/libelogind/sd-bus/test-bus-chat.c
b/src/libelogind/sd-bus/test-bus-chat.c
index 1e50dfc43323950eb2d189d20370be229ca88515..754335b5e7d98afbe8be0406710f6a0537d64f70 100644
(file)
--- a/
src/libelogind/sd-bus/test-bus-chat.c
+++ b/
src/libelogind/sd-bus/test-bus-chat.c
@@
-262,11
+262,11
@@
fail:
static void* client1(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
static void* client1(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
- _cleanup_bus_close_unref_ sd_bus *bus = NULL;
- sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_
flush_
close_unref_ sd_bus *bus = NULL;
+
_cleanup_bus_error_free_
sd_bus_error error = SD_BUS_ERROR_NULL;
const char *hello;
int r;
const char *hello;
int r;
- int pp[2] = { -1, -1 };
+
_cleanup_close_pair_
int pp[2] = { -1, -1 };
char x;
r = sd_bus_open_user(&bus);
char x;
r = sd_bus_open_user(&bus);
@@
-347,10
+347,6
@@
finish:
}
}
- sd_bus_error_free(&error);
-
- safe_close_pair(pp);
-
return INT_TO_PTR(r);
}
return INT_TO_PTR(r);
}
@@
-365,8
+361,8
@@
static int quit_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_er
static void* client2(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
static void* client2(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
- sd_bus *bus = NULL;
- sd_bus_error error = SD_BUS_ERROR_NULL;
+
_cleanup_bus_flush_close_unref_
sd_bus *bus = NULL;
+
_cleanup_bus_error_free_
sd_bus_error error = SD_BUS_ERROR_NULL;
bool quit = false;
const char *mid;
int r;
bool quit = false;
const char *mid;
int r;
@@
-395,8
+391,7
@@
static void* client2(void*p) {
goto finish;
}
goto finish;
}
- sd_bus_message_unref(m);
- m = NULL;
+ m = sd_bus_message_unref(m);
r = sd_bus_message_new_signal(
bus,
r = sd_bus_message_new_signal(
bus,
@@
-415,8
+410,7
@@
static void* client2(void*p) {
goto finish;
}
goto finish;
}
- sd_bus_message_unref(m);
- m = NULL;
+ m = sd_bus_message_unref(m);
r = sd_bus_message_new_method_call(
bus,
r = sd_bus_message_new_method_call(
bus,
@@
-444,8
+438,7
@@
static void* client2(void*p) {
log_info("Machine ID is %s.", mid);
log_info("Machine ID is %s.", mid);
- sd_bus_message_unref(m);
- m = NULL;
+ m = sd_bus_message_unref(m);
r = sd_bus_message_new_method_call(
bus,
r = sd_bus_message_new_method_call(
bus,
@@
-459,8
+452,7
@@
static void* client2(void*p) {
goto finish;
}
goto finish;
}
- sd_bus_message_unref(reply);
- reply = NULL;
+ reply = sd_bus_message_unref(reply);
r = sd_bus_call(bus, m, 200 * USEC_PER_MSEC, &error, &reply);
if (r < 0)
r = sd_bus_call(bus, m, 200 * USEC_PER_MSEC, &error, &reply);
if (r < 0)
@@
-468,8
+460,7
@@
static void* client2(void*p) {
else
log_info("Slow call succeed.");
else
log_info("Slow call succeed.");
- sd_bus_message_unref(m);
- m = NULL;
+ m = sd_bus_message_unref(m);
r = sd_bus_message_new_method_call(
bus,
r = sd_bus_message_new_method_call(
bus,
@@
-522,12
+513,9
@@
finish:
goto finish;
}
goto finish;
}
- sd_bus_send(bus, q, NULL);
- sd_bus_flush(bus);
- sd_bus_unref(bus);
+ (void) sd_bus_send(bus, q, NULL);
}
}
- sd_bus_error_free(&error);
return INT_TO_PTR(r);
}
return INT_TO_PTR(r);
}