diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-05-16 19:36:23 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-05-16 19:36:23 +0200 |
commit | 0e8d9ca47dab0d069e305d5784d05f2ade04f0a8 (patch) | |
tree | 5a69988bb3112276a3adf22cf97e36e4783edab4 /modules/im/ximcp | |
parent | 6d2bed8f04942b4de086a519ac693e729c9fdeea (diff) |
More constification.
Diffstat (limited to 'modules/im/ximcp')
-rw-r--r-- | modules/im/ximcp/imLcPrs.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c index ac53324..42f8f2a 100644 --- a/modules/im/ximcp/imLcPrs.c +++ b/modules/im/ximcp/imLcPrs.c @@ -278,32 +278,26 @@ static long modmask( char *name) { - long mask; - struct _modtbl { - const char *name; + const char name[6]; long mask; }; - struct _modtbl *p; - static struct _modtbl tbl[] = { + static const struct _modtbl tbl[] = { { "Ctrl", ControlMask }, { "Lock", LockMask }, { "Caps", LockMask }, { "Shift", ShiftMask }, { "Alt", Mod1Mask }, - { "Meta", Mod1Mask }, - { NULL, 0 }}; - - p = tbl; - mask = 0; - for (p = tbl; p->name != NULL; p++) { - if (strcmp(name, p->name) == 0) { - mask = p->mask; - break; - } - } - return(mask); + { "Meta", Mod1Mask }}; + + int i, num_entries = sizeof (tbl) / sizeof (tbl[0]); + + for (i = 0; i < num_entries; i++) + if (!strcmp (name, tbl[i].name)) + return tbl[i].mask; + + return 0; } static char* |