# include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/macros.h>
+
#include "mutt.h"
+#include "buffer.h"
+#include "ascii.h"
#include "mutt_menu.h"
#include "mutt_curses.h"
#include "keymap.h"
#include "mapping.h"
#include "mutt_crypt.h"
-#include "lib/mem.h"
-#include "lib/intl.h"
#include "lib/str.h"
#include <stdlib.h>
{"<Space>", ' '},
#ifdef KEY_BTAB
{"<BackTab>", KEY_BTAB},
+#endif
+#ifdef KEY_NEXT
+ {"<Next>", KEY_NEXT},
#endif
{NULL, 0}
};
struct keymap_t *Keymaps[MENU_MAX];
-static struct keymap_t *allocKeys (int len, keycode_t * keys)
+static struct keymap_t *allocKeys(int len, keycode_t *keys)
{
- struct keymap_t *p;
+ struct keymap_t *p;
- p = safe_calloc (1, sizeof (struct keymap_t));
- p->len = len;
- p->keys = safe_malloc (len * sizeof (keycode_t));
- memcpy (p->keys, keys, len * sizeof (keycode_t));
- return (p);
+ p = p_new(struct keymap_t, 1);
+ p->len = len;
+ p->keys = p_dup(keys, len);
+ return p;
}
static int parse_fkey (char *s)
return -1;
}
-static int parsekeys (char *str, keycode_t * d, int max)
+static int parsekeys (const char *str, keycode_t * d, int max)
{
int n, len = max;
char buff[SHORT_STRING];
/* insert a key sequence into the specified map. the map is sorted by ASCII
* value (lowest to highest)
*/
-void km_bind (char *s, int menu, int op, char *macro, char *descr)
+void km_bind (const char *s, int menu, int op, char *macro, char *descr)
{
struct keymap_t *map, *tmp, *last = NULL, *next;
keycode_t buf[MAX_SEQ];
do {
len = tmp->eq;
next = tmp->next;
- FREE (&tmp->macro);
- FREE (&tmp->keys);
- FREE (&tmp->descr);
- FREE (&tmp);
+ p_delete(&tmp->macro);
+ p_delete(&tmp->keys);
+ p_delete(&tmp->descr);
+ p_delete(&tmp);
tmp = next;
}
while (tmp && len >= pos);
Keymaps[menu] = map;
}
-void km_bindkey (char *s, int menu, int op)
+void km_bindkey (const char *s, int menu, int op)
{
km_bind (s, menu, op, NULL, NULL);
}
return OP_NULL;
}
-static char *get_func (struct binding_t *bindings, int op)
+static const char *get_func (struct binding_t *bindings, int op)
{
int i;
}
}
}
- mutt_ungetch (*p--, 0);
+ mutt_ungetch ((unsigned char) *p--, 0);
}
}
/* do we have an op already? */
if (tmp.op) {
- char *func = NULL;
+ const char *func = NULL;
struct binding_t *bindings;
/* is this a valid op for this menu? */
km_bindkey (map[i].seq, menu, map[i].op);
}
-char *km_keyname (int c)
+const char *km_keyname(int c)
{
static char buf[10];
- char *p;
+ const char *p;
if ((p = mutt_getnamebyvalue (c, KeyNames)))
return p;
strfcpy (err->data, _("too few arguments"), err->dsize);
}
error:
- FREE (&buf.data);
+ p_delete(&buf.data);
return (NULL);
}
}
}
}
- FREE (&key);
+ p_delete(&key);
return (r);
}
}
}
- FREE (&seq);
+ p_delete(&seq);
}
else {
for (i = 0; i < nummenus; ++i) {
}
}
}
- FREE (&key);
+ p_delete(&key);
return (r);
}