From: Christophe CURIS <christophe.cu...@free.fr>

CLang does not support nested function declaration, so we have to fall back
to using a macro, with all the drawbacks it has.
---
 src/misc.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/misc.c b/src/misc.c
index 51eb1ee..1846b23 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -763,21 +763,23 @@ char *GetShortcutKey(WShortKey key)
        char buffer[256];
        char *wr;
 
-       void append_string(const char *string)
-       {
-               while (*string) {
-                       if (wr >= buffer + sizeof(buffer) - 1)
-                               break;
-                       *wr++ = *string++;
-               }
+#define append_string(text)            \
+       {               \
+               const char *string = text; \
+\
+               while (*string) {               \
+                       if (wr >= buffer + sizeof(buffer) - 1)          \
+                               break;          \
+                       *wr++ = *string++;              \
+               }               \
        }
 
-       void append_modifier(int modifier_index, const char *fallback_name)
-       {
-               if (wPreferences.modifier_labels[modifier_index])
-                       
append_string(wPreferences.modifier_labels[modifier_index]);
-               else
-                       append_string(fallback_name);
+#define append_modifier(modifier_index, fallback_name)         \
+       {               \
+               if (wPreferences.modifier_labels[modifier_index])               
\
+                       
append_string(wPreferences.modifier_labels[modifier_index])             \
+               else            \
+                       append_string(fallback_name)            \
        }
 
        key_name = XKeysymToString(XkbKeycodeToKeysym(dpy, key.keycode, 0, 0));
-- 
2.1.3


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to