projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
exit str_cmp enters m_strcmp
[apps/madmutt.git]
/
keymap.c
diff --git
a/keymap.c
b/keymap.c
index
d28ca0f
..
76ac63c
100644
(file)
--- a/
keymap.c
+++ b/
keymap.c
@@
-12,19
+12,18
@@
#endif
#include <lib-lib/mem.h>
#endif
#include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
+#include <lib-lib/str.h>
+#include <lib-lib/macros.h>
+#include <lib-lib/buffer.h>
#include "mutt.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 "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>
#include <string.h>
#include <stdlib.h>
#include <string.h>
@@
-99,7
+98,7
@@
static struct keymap_t *allocKeys(int len, keycode_t *keys)
{
struct keymap_t *p;
{
struct keymap_t *p;
- p =
mem_calloc (1, sizeof (struct keymap_t)
);
+ p =
p_new(struct keymap_t, 1
);
p->len = len;
p->keys = p_dup(keys, len);
return p;
p->len = len;
p->keys = p_dup(keys, len);
return p;
@@
-195,8
+194,8
@@
void km_bind (const char *s, int menu, int op, char *macro, char *descr)
map = allocKeys (len, buf);
map->op = op;
map = allocKeys (len, buf);
map->op = op;
- map->macro =
str_dup
(macro);
- map->descr =
str_dup
(descr);
+ map->macro =
m_strdup
(macro);
+ map->descr =
m_strdup
(descr);
tmp = Keymaps[menu];
tmp = Keymaps[menu];
@@
-253,7
+252,7
@@
static int get_op (struct binding_t *bindings, const char *start, size_t len)
for (i = 0; bindings[i].name; i++) {
if (!ascii_strncasecmp (start, bindings[i].name, len) &&
for (i = 0; bindings[i].name; i++) {
if (!ascii_strncasecmp (start, bindings[i].name, len) &&
-
str_len
(bindings[i].name) == len)
+
m_strlen
(bindings[i].name) == len)
return bindings[i].op;
}
return bindings[i].op;
}
@@
-275,7
+274,7
@@
static const char *get_func (struct binding_t *bindings, int op)
static void push_string (char *s)
{
static void push_string (char *s)
{
- char *pp, *p = s +
str_len
(s) - 1;
+ char *pp, *p = s +
m_strlen
(s) - 1;
size_t l;
int i, op = OP_NULL;
size_t l;
int i, op = OP_NULL;
@@
-494,7
+493,7
@@
int km_expand_key (char *s, size_t len, struct keymap_t *map)
FOREVER {
strfcpy (s, km_keyname (map->keys[p]), len);
FOREVER {
strfcpy (s, km_keyname (map->keys[p]), len);
- len -= (l =
str_len
(s));
+ len -= (l =
m_strlen
(s));
if (++p >= map->len || !len)
return (1);
if (++p >= map->len || !len)
return (1);
@@
-517,7
+516,7
@@
struct keymap_t *km_find_func (int menu, int func)
void km_init (void)
{
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);
create_bindings (OpAttach, MENU_ATTACH);
create_bindings (OpBrowser, MENU_FOLDER);
@@
-678,7
+677,7
@@
static char *parse_keymap (int *menu, BUFFER * s, int maxmenus, int *nummenus,
int i = 0;
char *p, *q;
int i = 0;
char *p, *q;
-
memset (&buf, 0, sizeof (buf)
);
+
p_clear(&buf, 1
);
/* menu name */
mutt_extract_token (&buf, s, 0);
/* menu name */
mutt_extract_token (&buf, s, 0);
@@
-723,7
+722,7
@@
try_bind (char *key, int menu, char *func, struct binding_t *bindings)
int i;
for (i = 0; bindings[i].name; i++)
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);
}
km_bindkey (key, menu, bindings[i].op);
return (0);
}
@@
-838,7
+837,7
@@
int mutt_parse_macro (BUFFER * buf, BUFFER * s, unsigned long data,
}
else {
if (MoreArgs (s)) {
}
else {
if (MoreArgs (s)) {
- seq =
str_dup
(buf->data);
+ seq =
m_strdup
(buf->data);
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
if (MoreArgs (s)) {
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
if (MoreArgs (s)) {
@@
-886,9
+885,9
@@
int mutt_parse_exec (BUFFER * buf, BUFFER * s, unsigned long data,
&& CurrentMenu != MENU_PAGER)
bindings = OpGeneric;
&& CurrentMenu != MENU_PAGER)
bindings = OpGeneric;
- ops[nops] = get_op (bindings, function,
str_len
(function));
+ ops[nops] = get_op (bindings, function,
m_strlen
(function));
if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
- ops[nops] = get_op (OpGeneric, function,
str_len
(function));
+ ops[nops] = get_op (OpGeneric, function,
m_strlen
(function));
if (ops[nops] == OP_NULL) {
mutt_flushinp ();
if (ops[nops] == OP_NULL) {
mutt_flushinp ();