summaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-08-27 18:58:36 +0300
committerRan Benita <ran234@gmail.com>2012-09-02 19:17:09 +0300
commitefc2d74141fec07b0aa44640fbf667d6b52a8631 (patch)
tree074a77503af1d7c9675c3882ad133adb4b0cc985 /src/text.c
parent82491d5fd101393ef77122e449f23e30343f3d9f (diff)
xkbcomp: clean up compile_keymap function
We make the xkb_file_type enum sequential instead of masks, and then we don't have to repeat the file types several times in the function. Makes the code cleaner. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/text.c b/src/text.c
index 472dbcd..ae71d3a 100644
--- a/src/text.c
+++ b/src/text.c
@@ -226,25 +226,21 @@ ModMaskText(xkb_mod_mask_t mask)
return buf;
}
+static const char *xkb_file_type_strings[_FILE_TYPE_NUM_ENTRIES] = {
+ [FILE_TYPE_KEYMAP] = "xkb_keymap",
+ [FILE_TYPE_TYPES] = "xkb_types",
+ [FILE_TYPE_COMPAT] = "xkb_compatibility",
+ [FILE_TYPE_SYMBOLS] = "xkb_symbols",
+ [FILE_TYPE_KEYCODES] = "xkb_keycodes",
+ [FILE_TYPE_RULES] = "rules",
+};
+
const char *
FileTypeText(enum xkb_file_type type)
{
- switch (type) {
- case FILE_TYPE_KEYMAP:
- return "xkb_keymap";
- case FILE_TYPE_TYPES:
- return "xkb_types";
- case FILE_TYPE_COMPAT:
- return "xkb_compatability";
- case FILE_TYPE_SYMBOLS:
- return "xkb_symbols";
- case FILE_TYPE_KEYCODES:
- return "xkb_keycodes";
- case FILE_TYPE_RULES:
- return "rules";
- default:
+ if (type > _FILE_TYPE_NUM_ENTRIES)
return "unknown";
- }
+ return xkb_file_type_strings[type];
}
static const char *actionTypeNames[XkbSA_NumActions] = {