chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3840736
)
test-bus-chat: various modernizations
author
Lennart Poettering
<lennart@poettering.net>
Thu, 14 May 2015 20:41:19 +0000
(22:41 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Tue, 14 Mar 2017 08:56:08 +0000
(09:56 +0100)
src/libelogind/sd-bus/test-bus-chat.c
patch
|
blob
|
history
diff --git
a/src/libelogind/sd-bus/test-bus-chat.c
b/src/libelogind/sd-bus/test-bus-chat.c
index 1e50dfc43323950eb2d189d20370be229ca88515..046e999008283941f1087f37f2fc5466f0a66a70 100644
(file)
--- a/
src/libelogind/sd-bus/test-bus-chat.c
+++ b/
src/libelogind/sd-bus/test-bus-chat.c
@@
-263,10
+263,10
@@
fail:
static void* client1(void*p) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_close_unref_ sd_bus *bus = 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_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_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);
}