X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=keymap.c;h=0c450f77fd4977afc5122fde1814798dc5cb9f70;hp=586d4facd27f9adbe4497539349999b2ab7b4ee2;hb=c98480f8568e6c1bc927c6c5f2b5e80b4aa6548c;hpb=7f7a0be369840b290248e5b0302beb447fa1b3cd diff --git a/keymap.c b/keymap.c index 586d4fa..0c450f7 100644 --- a/keymap.c +++ b/keymap.c @@ -12,12 +12,12 @@ #endif #include +#include #include #include +#include #include "mutt.h" -#include "buffer.h" -#include "ascii.h" #include "mutt_menu.h" #include "mutt_curses.h" #include "keymap.h" @@ -272,9 +272,9 @@ static const char *get_func (struct binding_t *bindings, int op) return NULL; } -static void push_string (char *s) +static void push_string(const char *s) { - char *pp, *p = s + m_strlen(s) - 1; + const char *pp, *p = s + m_strlen(s) - 1; size_t l; int i, op = OP_NULL; @@ -359,7 +359,7 @@ int km_dokey (int menu) if (!map) return (retry_generic (menu, NULL, 0, 0)); - FOREVER { + for (;;) { /* ncurses doesn't return on resized screen when timeout is set to zero */ if (menu != MENU_EDITOR) timeout ((Timeout > 0 ? Timeout : 60) * 1000); @@ -403,7 +403,7 @@ int km_dokey (int menu) /* careful not to feed the <..> as one token. otherwise * push_string() will push the bogus op right back! */ mutt_ungetch ('>', 0); - push_string (func); + push_string(func); mutt_ungetch ('<', 0); break; } @@ -491,7 +491,7 @@ int km_expand_key (char *s, size_t len, struct keymap_t *map) if (!map) return (0); - FOREVER { + for (;;) { strfcpy (s, km_keyname (map->keys[p]), len); len -= (l = m_strlen(s)); @@ -516,7 +516,7 @@ struct keymap_t *km_find_func (int menu, int func) void km_init (void) { - memset (Keymaps, 0, sizeof (struct keymap_t *) * MENU_MAX); + p_clear(Keymaps, MENU_MAX); create_bindings (OpAttach, MENU_ATTACH); create_bindings (OpBrowser, MENU_FOLDER); @@ -677,7 +677,7 @@ static char *parse_keymap (int *menu, BUFFER * s, int maxmenus, int *nummenus, int i = 0; char *p, *q; - memset (&buf, 0, sizeof (buf)); + p_clear(&buf, 1); /* menu name */ mutt_extract_token (&buf, s, 0); @@ -722,7 +722,7 @@ try_bind (char *key, int menu, char *func, struct binding_t *bindings) int i; for (i = 0; bindings[i].name; i++) - if (str_cmp (func, bindings[i].name) == 0) { + if (m_strcmp(func, bindings[i].name) == 0) { km_bindkey (key, menu, bindings[i].op); return (0); }