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.
This commit is contained in:
Christian Kellner 2019-05-20 14:39:09 +02:00
parent 16e7d06083
commit 536d687c9a

View File

@ -39,6 +39,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include <systemd/sd-bus.h>
#include <unistd.h>
// 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,