use m_strdup and m_strlen that are inlined for efficiency
[apps/madmutt.git] / curs_lib.c
index ddac70b..80c81dd 100644 (file)
@@ -16,6 +16,7 @@
 #endif
 
 #include <lib-lib/mem.h>
+#include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 
 #include "mutt.h"
@@ -25,7 +26,6 @@
 #include "pager.h"
 #include "mbyte.h"
 
-#include "lib/str.h"
 #include "lib/debug.h"
 
 #include <wchar.h>
@@ -205,7 +205,7 @@ int mutt_yesorno (const char *msg, int def)
   answer_string = p_new(char, COLS + 1);
   snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
             def == M_YES ? no : yes);
-  answer_string_len = str_len (answer_string);
+  answer_string_len = m_strlen(answer_string);
   printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
   p_delete(&answer_string);
 
@@ -465,7 +465,7 @@ int _mutt_enter_fname (const char *prompt, char *buf, size_t blen,
     *redraw = REDRAW_FULL;
   }
   else {
-    char *pc = p_new(char, str_len(prompt) + 3);
+    char *pc = p_new(char, m_strlen(prompt) + 3);
 
     sprintf (pc, "%s: ", prompt);       /* __SPRINTF_CHECKED__ */
     mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
@@ -545,7 +545,7 @@ int mutt_multi_choice (char *prompt, char *letters)
       }
       else if (ch.ch <= '9' && ch.ch > '0') {
         choice = ch.ch - '0';
-        if (choice <= str_len (letters))
+        if (choice <= m_strlen(letters))
           break;
       }
     }
@@ -665,7 +665,7 @@ static void mutt_format_s_x (char *dest,
   }
 
   mutt_format_string (dest, destlen, min_width, max_width,
-                      right_justify, ' ', s, str_len (s), arboreal);
+                      right_justify, ' ', s, m_strlen(s), arboreal);
 }
 
 void mutt_format_s (char *dest,
@@ -690,7 +690,7 @@ void mutt_paddstr (int n, const char *s)
   wchar_t wc;
   int w;
   size_t k;
-  size_t len = str_len (s);
+  size_t len = m_strlen(s);
   mbstate_t mbstate;
 
   memset (&mbstate, 0, sizeof (mbstate));
@@ -714,7 +714,7 @@ void mutt_paddstr (int n, const char *s)
 }
 
 /*
- * mutt_strwidth is like str_len except that it returns the width
+ * mutt_strwidth is like m_strlenexcept that it returns the width
  * refering to the number of characters cells.
  */
 
@@ -728,7 +728,7 @@ int mutt_strwidth (const char *s)
   if (!s)
     return 0;
 
-  n = str_len (s);
+  n = m_strlen(s);
 
   memset (&mbstate, 0, sizeof (mbstate));
   for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {