From 764dafa29fdb42e331c3edc960f5938254ca77d5 Mon Sep 17 00:00:00 2001 From: Antti K Date: Tue, 29 Jul 2014 23:30:49 +0200 Subject: Consistency: Make default display a const char * Yep, `hostname` is a `const char *` too, even though it's potentially being assigned to. This is [unintuitive](http://stackoverflow.com/a/9834194/777586), but intentional. --- compile | 2 +- xkbcat.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compile b/compile index 4b8f85e..41d4254 100755 --- a/compile +++ b/compile @@ -1 +1 @@ -clang --std=gnu11 -Wall -o xkbcat -lX11 xkbcat.c +clang --std=gnu11 -pedantic -Wall -o xkbcat -lX11 xkbcat.c diff --git a/xkbcat.c b/xkbcat.c index 7cdb800..1fc3ff3 100644 --- a/xkbcat.c +++ b/xkbcat.c @@ -8,9 +8,9 @@ #include #include -char * DEFAULT_DISPLAY = ":0"; -const int DEFAULT_DELAY = 10000000; -const bool DEFAULT_PRINT_UP = false; +const char * DEFAULT_DISPLAY = ":0"; +const int DEFAULT_DELAY = 10000000; +const bool DEFAULT_PRINT_UP = false; typedef char KbBuffer[32]; static inline bool keyState(KbBuffer b, int key) { @@ -31,9 +31,9 @@ USAGE: xkbcat [-display ] [-delay ] [-up]\n\ int main(int argc, char * argv[]) { - char * hostname = DEFAULT_DISPLAY; - int delay = DEFAULT_DELAY; - bool printKeyUps = DEFAULT_PRINT_UP; + const char * hostname = DEFAULT_DISPLAY; + int delay = DEFAULT_DELAY; + bool printKeyUps = DEFAULT_PRINT_UP; // Get args for (int i = 1; i < argc; i++) { -- cgit v1.3-2-g0d8e