summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/busctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-24 21:39:18 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-25 14:28:34 +0100
commit1d58a1fe13cd725110be595c40cdc973d7e57d9e (patch)
treea91e59c07cd95b4df7610d96f6ecf839dc98daae /src/libsystemd/sd-bus/busctl.c
parent5cf4f2d1761cba895315d8f1f137afb3fdcd7a85 (diff)
busctl: improve readability a bit
Diffstat (limited to 'src/libsystemd/sd-bus/busctl.c')
-rw-r--r--src/libsystemd/sd-bus/busctl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 2cea21ed59..b2c7be20ae 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -67,6 +67,9 @@ static void pager_open_if_enabled(void) {
pager_open(false);
}
+#define NAME_IS_ACQUIRED INT_TO_PTR(1)
+#define NAME_IS_ACTIVATABLE INT_TO_PTR(2)
+
static int list_bus_names(sd_bus *bus, char **argv) {
_cleanup_strv_free_ char **acquired = NULL, **activatable = NULL;
_cleanup_free_ char **merged = NULL;
@@ -99,7 +102,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
STRV_FOREACH(i, acquired) {
max_i = MAX(max_i, strlen(*i));
- r = hashmap_put(names, *i, INT_TO_PTR(1));
+ r = hashmap_put(names, *i, NAME_IS_ACQUIRED);
if (r < 0) {
log_error("Failed to add to hashmap: %s", strerror(-r));
return r;
@@ -109,7 +112,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
STRV_FOREACH(i, activatable) {
max_i = MAX(max_i, strlen(*i));
- r = hashmap_put(names, *i, INT_TO_PTR(2));
+ r = hashmap_put(names, *i, NAME_IS_ACTIVATABLE);
if (r < 0 && r != -EEXIST) {
log_error("Failed to add to hashmap: %s", strerror(-r));
return r;
@@ -137,7 +140,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
sd_id128_t mid;
- if (hashmap_get(names, *i) == INT_TO_PTR(2)) {
+ if (hashmap_get(names, *i) == NAME_IS_ACTIVATABLE) {
/* Activatable */
printf("%-*s", (int) max_i, *i);