diff options
| author | 2014-07-29 16:49:25 +0200 | |
|---|---|---|
| committer | 2014-07-29 20:35:36 +0200 | |
| commit | 4d47eb99842b53d3e02d06c189d89e731f8361a3 (patch) | |
| tree | 8ab427757132a8a6caae4031f145108bd334c540 | |
| parent | c12aa06f8022fb9cb08b1e65dfed06aa4d8815f1 (diff) | |
| download | xkbcat-4d47eb99842b53d3e02d06c189d89e731f8361a3.tar.gz xkbcat-4d47eb99842b53d3e02d06c189d89e731f8361a3.zip | |
Convert simple macros to C99 constants
Constants are type-checked; macros aren't.
| -rwxr-xr-x | compile | 2 | ||||
| -rw-r--r-- | xkbcat.c | 16 |
2 files changed, 9 insertions, 9 deletions
@@ -1 +1 @@ -clang -o xkbcat -lX11 xkbcat.c +clang --std=c11 -Wall -o xkbcat -lX11 xkbcat.c @@ -22,13 +22,13 @@ #include <stdlib.h> #include <unistd.h> -#define DEFAULT_DISPLAY ":0" -#define DEFAULT_DELAY 10000 -#define BIT(c, x) ( c[x/8]& (1<<(x%8)) ) -#define TRUE 1 -#define FALSE 0 +const int TRUE = 1; +const int FALSE = 0; -#define KEYSYM_STRLEN 64 +char *DEFAULT_DISPLAY = ":0"; +const int DEFAULT_DELAY = 10000; +#define BIT(c, x) ( c[x/8]& (1<<(x%8)) ) +const int KEYSYM_STRLEN = 64; /* Globals */ Display *disp; @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { buf1[32], buf2[32], *keys, *saved; - int i, delay = DEFAULT_DELAY; + int i, delay = DEFAULT_DELAY; /* get args */ for (i=1; i<argc; i++) { @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) { */ char *KeyCodeToStr(int code, int down) { - static char *str, buf[KEYSYM_STRLEN+1]; + static char *str, buf[KEYSYM_STRLEN + 1]; KeySym keysym = XKeycodeToKeysym(disp, code, 0); if (NoSymbol == keysym) return ""; |
