chiark / gitweb /
Build fix: stop initialising an auto char array.
authorSimon Tatham <anakin@pobox.com>
Mon, 23 Apr 2018 17:42:13 +0000 (18:42 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 23 Apr 2018 17:42:13 +0000 (18:42 +0100)
Checking with the standards, I think this is legal C99, but not legal
C89 - and we are compiling in C89 mode. Why _every_ version of gcc
didn't object, given all the warning and pedantry options, I'm not
sure, but one did, so I should fix it.

misc.c

diff --git a/misc.c b/misc.c
index 917958aa313f2aa9f9d685d9e936152e560676fa..734ca5dc2d6577806e0b66c14c8462aafd3b9f01 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -412,7 +412,9 @@ char *button2label(int button)
        ('a' <= button && button <= 'z') ||
        ('0' <= button && button <= '9') )
     {
-        char str[2] = { button, '\0' };
+        char str[2];
+        str[0] = button;
+        str[1] = '\0';
         return dupstr(str);
     }