tools: don't depend on src/utils.h The idea is to make the tools/demos as standalone as possible so that they may serve as examples as well. Signed-off-by: Ran Benita <ran@unusedvar.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
diff --git a/tools/interactive-evdev.c b/tools/interactive-evdev.c
index e09da6a..e8afb5e 100644
--- a/tools/interactive-evdev.c
+++ b/tools/interactive-evdev.c
@@ -459,11 +459,11 @@ main(int argc, char *argv[])
}
else {
struct xkb_rule_names rmlvo = {
- .rules = isempty(rules) ? NULL : rules,
- .model = isempty(model) ? NULL : model,
- .layout = isempty(layout) ? NULL : layout,
- .variant = isempty(variant) ? NULL : variant,
- .options = isempty(options) ? NULL : options
+ .rules = (rules == NULL || rules[0] == '\0') ? NULL : rules,
+ .model = (model == NULL || model[0] == '\0') ? NULL : model,
+ .layout = (layout == NULL || layout[0] == '\0') ? NULL : layout,
+ .variant = (variant == NULL || variant[0] == '\0') ? NULL : variant,
+ .options = (options == NULL || options[0] == '\0') ? NULL : options
};
if (!rules && !model && !layout && !variant && !options)
diff --git a/tools/interactive-wayland.c b/tools/interactive-wayland.c
index 0ffccd0..8cc41de 100644
--- a/tools/interactive-wayland.c
+++ b/tools/interactive-wayland.c
@@ -28,9 +28,12 @@
#include <errno.h>
#include <fcntl.h>
#include <locale.h>
+#include <stdbool.h>
#include <stdint.h>
-#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/mman.h>
+#include <unistd.h>
#include "xkbcommon/xkbcommon.h"
#include "tools-common.h"
@@ -39,6 +42,8 @@
#include "xdg-shell-client-protocol.h"
#include <wayland-util.h>
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
struct interactive_dpy {
struct wl_display *dpy;
struct wl_compositor *compositor;
diff --git a/tools/interactive-x11.c b/tools/interactive-x11.c
index 4cc24d8..d98433e 100644
--- a/tools/interactive-x11.c
+++ b/tools/interactive-x11.c
@@ -24,6 +24,8 @@
#include "config.h"
#include <locale.h>
+#include <stdbool.h>
+#include <stdlib.h>
#include <xcb/xkb.h>
diff --git a/tools/print-compiled-keymap.c b/tools/print-compiled-keymap.c
index 04d98ba..1ba648b 100644
--- a/tools/print-compiled-keymap.c
+++ b/tools/print-compiled-keymap.c
@@ -23,11 +23,12 @@
#include "config.h"
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include "utils.h"
#include "xkbcommon/xkbcommon.h"
int
@@ -63,7 +64,7 @@ main(int argc, char *argv[])
goto out;
}
- if (streq(keymap_path, "-")) {
+ if (strcmp(keymap_path, "-") == 0) {
FILE *tmp;
tmp = tmpfile();
diff --git a/tools/tools-common.h b/tools/tools-common.h
index e971af5..f0faa34 100644
--- a/tools/tools-common.h
+++ b/tools/tools-common.h
@@ -33,7 +33,6 @@
#define _XKBCOMMON_COMPAT_H
#include "xkbcommon/xkbcommon.h"
#include "xkbcommon/xkbcommon-compose.h"
-#include "utils.h"
void
tools_print_keycode_state(struct xkb_state *state,