diff options
author | Ran Benita <ran234@gmail.com> | 2012-08-27 18:58:36 +0300 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-09-02 19:17:09 +0300 |
commit | efc2d74141fec07b0aa44640fbf667d6b52a8631 (patch) | |
tree | 074a77503af1d7c9675c3882ad133adb4b0cc985 /src/text.c | |
parent | 82491d5fd101393ef77122e449f23e30343f3d9f (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.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -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] = { |