uinput: Move SYS_INPUT_DIR to where it is used

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>
This commit is contained in:
Niclas Zeising 2020-08-13 11:59:20 +02:00
parent 1bf2b41d3f
commit 153d8d0a5a

View 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