use m_strdup and m_strlen that are inlined for efficiency
[apps/madmutt.git] / keymap.c
index 707a8cb..586d4fa 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -12,6 +12,7 @@
 #endif
 
 #include <lib-lib/mem.h>
+#include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 
 #include "mutt.h"
@@ -23,7 +24,6 @@
 #include "mapping.h"
 #include "mutt_crypt.h"
 
-#include "lib/str.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -194,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->macro = str_dup (macro);
-  map->descr = str_dup (descr);
+  map->macro = m_strdup(macro);
+  map->descr = m_strdup(descr);
 
   tmp = Keymaps[menu];
 
@@ -252,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) &&
-        str_len (bindings[i].name) == len)
+        m_strlen(bindings[i].name) == len)
       return bindings[i].op;
   }
 
@@ -274,7 +274,7 @@ static const char *get_func (struct binding_t *bindings, int op)
 
 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;
 
@@ -493,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);
-    len -= (l = str_len (s));
+    len -= (l = m_strlen(s));
 
     if (++p >= map->len || !len)
       return (1);
@@ -837,7 +837,7 @@ int mutt_parse_macro (BUFFER * buf, BUFFER * s, unsigned long data,
   }
   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)) {
@@ -885,9 +885,9 @@ int mutt_parse_exec (BUFFER * buf, BUFFER * s, unsigned long data,
         && 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)
-      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 ();