summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f50084d)
raw | patch | inline | side by side (parent: f50084d)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 4 Feb 2009 13:25:06 +0000 (14:25 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 5 Feb 2009 20:56:50 +0000 (21:56 +0100) |
tig.c | patch | blob | history |
index c5e3380bbd5a267f38639a02647b66e76f14d29e..6f13a2f2b9e1c76fd5cf45b9e5b007edc56cfe9b 100644 (file)
--- a/tig.c
+++ b/tig.c
request = get_request(argv[2]);
if (request == REQ_NONE) {
- struct {
- const char *name;
- enum request request;
- } obsolete[] = {
- { "cherry-pick", REQ_NONE },
- { "screen-resize", REQ_NONE },
- { "tree-parent", REQ_PARENT },
+ static struct enum_map obsolete[] = {
+ ENUM_MAP("cherry-pick", REQ_NONE),
+ ENUM_MAP("screen-resize", REQ_NONE),
+ ENUM_MAP("tree-parent", REQ_PARENT),
};
- size_t namelen = strlen(argv[2]);
- int i;
+ int alias;
- for (i = 0; i < ARRAY_SIZE(obsolete); i++) {
- if (namelen != strlen(obsolete[i].name) ||
- string_enum_compare(obsolete[i].name, argv[2], namelen))
- continue;
- if (obsolete[i].request != REQ_NONE)
- add_keybinding(keymap, obsolete[i].request, key);
+ if (map_enum(&alias, obsolete, argv[2])) {
+ if (alias != REQ_NONE)
+ add_keybinding(keymap, alias, key);
config_msg = "Obsolete request name";
return ERR;
}