From 536d687c9a396aaa74d92a377987754ac53b3b7a Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 20 May 2019 14:39:09 +0200 Subject: [PATCH] Use defines for dbus name, path, interface That gives some meaning to the strings and makes it easier to see what the arguments of sd_bus_call_method mean without checking the function docs. --- lib/client_impl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/client_impl.c b/lib/client_impl.c index 9ddaf3e..1c842d6 100644 --- a/lib/client_impl.c +++ b/lib/client_impl.c @@ -39,6 +39,11 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +// D-Bus name, path, iface +#define DAEMON_DBUS_NAME "com.feralinteractive.GameMode" +#define DAEMON_DBUS_PATH "/com/feralinteractive/GameMode" +#define DAEMON_DBUS_IFACE "com.feralinteractive.GameMode" + // Storage for error strings static char error_string[512] = { 0 }; @@ -62,9 +67,9 @@ static int gamemode_request(const char *function, int arg) } else { // Attempt to send the requested function ret = sd_bus_call_method(bus, - "com.feralinteractive.GameMode", - "/com/feralinteractive/GameMode", - "com.feralinteractive.GameMode", + DAEMON_DBUS_NAME, + DAEMON_DBUS_PATH, + DAEMON_DBUS_IFACE, function, &err, &msg,