uinput: Move SYS_INPUT_DIR to where it is used
authorNiclas Zeising <zeising@daemonic.se>
Thu, 13 Aug 2020 09:59:20 +0000 (11:59 +0200)
committerNiclas Zeising <zeising@daemonic.se>
Fri, 14 Aug 2020 15:50:56 +0000 (17:50 +0200)
Move the definition of SYS_INPUT_DIR to where it is used, instead of at
the top of the file, to make it easier to find.
Undefine it at the end of usage to avoid accidental uses.

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
libevdev/libevdev-uinput.c

index 24332f5a5d8e86691bc4fb931cf91ae5cdddc95d..7bbff440485df01b831236ba070db29679c2fd58 100644 (file)
@@ -38,8 +38,6 @@
 #include "libevdev-uinput-int.h"
 #include "libevdev-util.h"
 
-#define SYS_INPUT_DIR "/sys/devices/virtual/input/"
-
 #ifndef UINPUT_IOCTL_BASE
 #define UINPUT_IOCTL_BASE       'U'
 #endif
@@ -217,6 +215,7 @@ static int is_input_device(const struct dirent *dent) {
 static int
 fetch_syspath_and_devnode(struct libevdev_uinput *uinput_dev)
 {
+#define SYS_INPUT_DIR "/sys/devices/virtual/input/"
        struct dirent **namelist;
        int ndev, i;
        int rc;
@@ -290,6 +289,7 @@ fetch_syspath_and_devnode(struct libevdev_uinput *uinput_dev)
        free(namelist);
 
        return uinput_dev->devnode ? 0 : -1;
+#undef SYS_INPUT_DIR
 }
 
 static int