drop the old string API fully.
authorPierre Habouzit <madcoder@debian.org>
Sat, 4 Nov 2006 15:26:20 +0000 (16:26 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sat, 4 Nov 2006 15:26:20 +0000 (16:26 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
25 files changed:
buffy.c
compose.c
crypt-gpgme.c
headers.c
imap/imap.c
init.c
lib-lib/buffer.c
lib-lib/file.c
lib-lib/str.c
lib-lib/str.h
lib/Makefile.am
lib/str.c [deleted file]
lib/str.h [deleted file]
muttlib.c
nntp/newsrc.c
nntp/nntp.c
parse.c
pattern.c
pgpkey.c
pgppubring.c
pop/pop_lib.c
rfc1524.c
sendlib.c
sidebar.c
smime.c

diff --git a/buffy.c b/buffy.c
index ff316cc..f2d4887 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -180,7 +180,7 @@ int buffy_lookup (const char* path) {
   if (list_empty(Incoming) || !path || !*path)
     return (-1);
   for (i = 0; i < Incoming->length; i++) {
   if (list_empty(Incoming) || !path || !*path)
     return (-1);
   for (i = 0; i < Incoming->length; i++) {
-    if (str_eq (((BUFFY*) Incoming->data[i])->path, path) )
+    if (!m_strcmp(((BUFFY*)Incoming->data[i])->path, path) )
       return (i);
   }
   return (-1);
       return (i);
   }
   return (-1);
@@ -200,7 +200,7 @@ int buffy_parse_mailboxes (BUFFER * path, BUFFER * s, unsigned long data,
     mutt_extract_token (path, s, 0);
     m_strcpy(buf, sizeof(buf), path->data);
 
     mutt_extract_token (path, s, 0);
     m_strcpy(buf, sizeof(buf), path->data);
 
-    if (data == M_UNMAILBOXES && str_eq (buf, "*")) {
+    if (data == M_UNMAILBOXES && !strcmp(buf, "*")) {
       list_del (&Incoming, (list_del_t*) buffy_free);
       return 0;
     }
       list_del (&Incoming, (list_del_t*) buffy_free);
       return 0;
     }
@@ -334,7 +334,7 @@ int buffy_check (int force)
      * before polling */
     if (!Context || !Context->path || (local ? (sb.st_dev != contex_sb.st_dev ||
                                                 sb.st_ino != contex_sb.st_ino) : 
      * before polling */
     if (!Context || !Context->path || (local ? (sb.st_dev != contex_sb.st_dev ||
                                                 sb.st_ino != contex_sb.st_ino) : 
-                                       !str_eq (tmp->path, Context->path))) {
+                                       !m_strcmp(tmp->path, Context->path))) {
       switch (tmp->magic) {
       case M_MBOX:
       case M_MMDF:
       switch (tmp->magic) {
       case M_MBOX:
       case M_MMDF:
@@ -591,7 +591,7 @@ void buffy_next (char *s, size_t slen)
   i = 1 + buffy_lookup (s);
   for (l=0; l < Incoming->length; l++) {
     c = (l+i) % Incoming->length;
   i = 1 + buffy_lookup (s);
   for (l=0; l < Incoming->length; l++) {
     c = (l+i) % Incoming->length;
-    if ((!Context || !Context->path || !str_eq (((BUFFY*) Incoming->data[c])->path, Context->path)) &&
+    if ((!Context || !Context->path || m_strcmp(((BUFFY*) Incoming->data[c])->path, Context->path)) &&
         ((BUFFY*) Incoming->data[c])->new > 0)
       break;
   }
         ((BUFFY*) Incoming->data[c])->new > 0)
       break;
   }
index 508c151..09acea2 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -623,8 +623,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0
             && buf[0]) {
           p_delete(&msg->env->newsgroups);
         if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0
             && buf[0]) {
           p_delete(&msg->env->newsgroups);
-          str_skip_trailws (buf);
-          msg->env->newsgroups = m_strdup(vskipspaces(buf));
+          m_strrtrim(buf);
+          msg->env->newsgroups = m_strdup(skipspaces(buf));
           move (HDR_TO, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->newsgroups)
           move (HDR_TO, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->newsgroups)
@@ -641,8 +641,8 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0
             && buf[0]) {
           p_delete(&msg->env->followup_to);
         if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0
             && buf[0]) {
           p_delete(&msg->env->followup_to);
-          str_skip_trailws (buf);
-          msg->env->followup_to = m_strdup(vskipspaces(buf));
+          m_strrtrim(buf);
+          msg->env->followup_to = m_strdup(skipspaces(buf));
           move (HDR_CC, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->followup_to)
           move (HDR_CC, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->followup_to)
index 4255156..a3dedae 100644 (file)
@@ -3576,7 +3576,7 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
         || (option (OPTPGPLONGIDS)
             && !m_strncasecmp(p, "0x", 2)
             && !m_strcasecmp(p + 2, crypt_keyid (k) + 8))
         || (option (OPTPGPLONGIDS)
             && !m_strncasecmp(p, "0x", 2)
             && !m_strcasecmp(p + 2, crypt_keyid (k) + 8))
-        || str_isstr (k->uid, p)) {
+        || m_stristr(k->uid, p)) {
       crypt_key_t *tmp;
 
       debug_print (5, ("match.\n"));
       crypt_key_t *tmp;
 
       debug_print (5, ("match.\n"));
index a3476a8..a9be3cd 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -144,7 +144,7 @@ void mutt_edit_headers (const char *editor,
       p = vskipspaces(cur->data + 7);
       if (*p) {
         if ((q = strpbrk (p, " \t"))) {
       p = vskipspaces(cur->data + 7);
       if (*p) {
         if ((q = strpbrk (p, " \t"))) {
-          str_substrcpy(path, p, q, sizeof(path));
+          m_strncpy(path, sizeof(path), p, q - p);
           q = vskipspaces(q);
         }
         else
           q = vskipspaces(q);
         }
         else
index 4b004f1..57648c6 100644 (file)
@@ -904,7 +904,7 @@ int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
   if (mutt_bit_isset (idata->rights, ACL_WRITE))
     imap_add_keywords (flags, hdr, idata->flags, sizeof (flags));
 
   if (mutt_bit_isset (idata->rights, ACL_WRITE))
     imap_add_keywords (flags, hdr, idata->flags, sizeof (flags));
 
-  str_skip_trailws (flags);
+  m_strrtrim(flags);
 
   /* UW-IMAP is OK with null flags, Cyrus isn't. The only solution is to
    * explicitly revoke all system flags (if we have permission) */
 
   /* UW-IMAP is OK with null flags, Cyrus isn't. The only solution is to
    * explicitly revoke all system flags (if we have permission) */
@@ -915,7 +915,7 @@ int imap_sync_message (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
     imap_set_flag (idata, ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
     imap_set_flag (idata, ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
 
     imap_set_flag (idata, ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
     imap_set_flag (idata, ACL_DELETE, 1, "\\Deleted ", flags, sizeof (flags));
 
-    str_skip_trailws (flags);
+    m_strrtrim(flags);
 
     mutt_buffer_addstr (cmd, " -FLAGS.SILENT (");
   } else
 
     mutt_buffer_addstr (cmd, " -FLAGS.SILENT (");
   } else
diff --git a/init.c b/init.c
index 624ef3b..fdaf0c9 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2617,7 +2617,7 @@ void mutt_init (int skip_sys_rc, LIST * commands)
   uname (&utsname);
   /* some systems report the FQDN instead of just the hostname */
   if ((p = strchr (utsname.nodename, '.'))) {
   uname (&utsname);
   /* some systems report the FQDN instead of just the hostname */
   if ((p = strchr (utsname.nodename, '.'))) {
-    Hostname = str_substrdup (utsname.nodename, p);
+    Hostname = p_dupstr(utsname.nodename, p - utsname.nodename);
     p++;
     m_strcpy(buffer, sizeof(buffer), p);       /* save the domain for below */
   }
     p++;
     m_strcpy(buffer, sizeof(buffer), p);       /* save the domain for below */
   }
index 6b46380..47e58ba 100644 (file)
@@ -259,7 +259,7 @@ int mutt_extract_token(BUFFER *dest, BUFFER *tok, int flags)
             if (*tok->dptr == '{') {
                 tok->dptr++;
                 if ((pc = strchr (tok->dptr, '}'))) {
             if (*tok->dptr == '{') {
                 tok->dptr++;
                 if ((pc = strchr (tok->dptr, '}'))) {
-                    var = str_substrdup (tok->dptr, pc);
+                    var = p_dupstr(tok->dptr, pc - tok->dptr);
                     tok->dptr = pc + 1;
                 }
             } else {
                     tok->dptr = pc + 1;
                 }
             } else {
index 6442667..36d34a3 100644 (file)
@@ -39,7 +39,6 @@
 #include "file.h"
 
 #include "../lib/debug.h"
 #include "file.h"
 
 #include "../lib/debug.h"
-#include "../lib/str.h"
 
 #ifndef O_NOFOLLOW
 #  define O_NOFOLLOW  0
 
 #ifndef O_NOFOLLOW
 #  define O_NOFOLLOW  0
index 3b9b5b5..a5333e4 100644 (file)
@@ -94,3 +94,50 @@ ssize_t m_strncpy(char *dst, ssize_t n, const char *src, ssize_t l)
 
     return len;
 }
 
     return len;
 }
+
+char *m_strrtrim(char *s)
+{
+    if (s) {
+        char *p = s + m_strlen(s);
+
+        while (p > s && ISSPACE(p[-1])) {
+            *--p = '\0';
+        }
+        return p;
+    }
+
+    return NULL;
+}
+
+const char *m_stristrn(const char *haystack, const char *needle, ssize_t nlen)
+{
+    int nc;
+
+    if (!nlen)
+        return haystack;
+
+    nc = tolower(*needle);
+    for (;;) {
+        int c = tolower(*haystack);
+
+        if (c != nc) {
+            if (c == '\0')
+                return NULL;
+        } else {
+            ssize_t i;
+
+            /* compare the rest of needle */
+            for (i = 1;; i++) {
+                if (i == nlen)
+                    return haystack;
+                if (c == '\0')
+                    return NULL;
+                c = tolower(haystack[i]);
+                if (c != tolower(needle[i]))
+                    break;
+            }
+        }
+
+        haystack++;
+    }
+}
index 55a89b9..bb2d822 100644 (file)
@@ -23,8 +23,6 @@
 #include <string.h>
 #include <ctype.h>
 
 #include <string.h>
 #include <ctype.h>
 
-#include "../lib/str.h"
-
 #include "mem.h"
 
 #define HUGE_STRING     5120
 #include "mem.h"
 
 #define HUGE_STRING     5120
@@ -43,7 +41,7 @@ extern char const __m_b36chars_lower[36];
 extern char const __m_b36chars_upper[36];
 
 /****************************************************************************/
 extern char const __m_b36chars_upper[36];
 
 /****************************************************************************/
-/* char related                                                             */
+/* conversions                                                              */
 /****************************************************************************/
 
 static inline int hexval(int c) {
 /****************************************************************************/
 
 static inline int hexval(int c) {
@@ -54,6 +52,11 @@ static inline int base64val(int c) {
     return (c & ~127) ? -1 : __m_b64digits[c];
 }
 
     return (c & ~127) ? -1 : __m_b64digits[c];
 }
 
+static inline void m_strtolower(char *p) {
+    for (; *p; p++)
+        *p = tolower((unsigned char)*p);
+}
+
 /****************************************************************************/
 /* length related                                                           */
 /****************************************************************************/
 /****************************************************************************/
 /* length related                                                           */
 /****************************************************************************/
@@ -100,6 +103,10 @@ static inline char *m_strdup(const char *s) {
     return len ? p_dup(s, len + 1) : NULL;
 }
 
     return len ? p_dup(s, len + 1) : NULL;
 }
 
+static inline char *m_substrdup(const char *s, const char *end) {
+    return p_dupstr(s, end ? end - s : m_strlen(s));
+}
+
 static inline char *m_strreplace(char **p, const char *s) {
     p_delete(p);
     return (*p = m_strdup(s));
 static inline char *m_strreplace(char **p, const char *s) {
     p_delete(p);
     return (*p = m_strdup(s));
@@ -132,4 +139,18 @@ static inline char *vskipspaces(const char *s) {
     return (char *)skipspaces(s);
 }
 
     return (char *)skipspaces(s);
 }
 
+char *m_strrtrim(char *s);
+
+/****************************************************************************/
+/* search                                                                   */
+/****************************************************************************/
+
+const char *
+m_stristrn(const char *haystack, const char *needle, ssize_t nlen);
+
+static inline const char *
+m_stristr(const char *haystack, const char *needle) {
+    return m_stristrn(haystack, needle, m_strlen(needle));
+}
+
 #endif /* MUTT_LIB_LIB_STR_H */
 #endif /* MUTT_LIB_LIB_STR_H */
index 24b3676..775d21e 100644 (file)
@@ -5,9 +5,9 @@ AR=@AR@
 AUTOMAKE_OPTIONS = foreign
 
 noinst_LIBRARIES = libsane.a
 AUTOMAKE_OPTIONS = foreign
 
 noinst_LIBRARIES = libsane.a
-noinst_HEADERS = str.h list.h rx.h debug.h
+noinst_HEADERS = list.h rx.h debug.h
 
 
-libsane_a_SOURCES = str.c list.c rx.h debug.h \
-                   str.h list.h rx.c debug.c
+libsane_a_SOURCES = list.c rx.h debug.h \
+                   list.h rx.c debug.c
 
 -include ../cflags.mk
 
 -include ../cflags.mk
diff --git a/lib/str.c b/lib/str.c
deleted file mode 100644 (file)
index 3d3f10e..0000000
--- a/lib/str.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
-
-#include "str.h"
-
-/* convert all characters in the string to lowercase */
-char *str_tolower (char *s)
-{
-  char *p = s;
-
-  while (*p) {
-    *p = tolower ((unsigned char) *p);
-    p++;
-  }
-
-  return (s);
-}
-
-/* NULL-pointer aware string comparison functions */
-
-char *str_substrcpy (char *dest, const char *beg, const char *end,
-                      size_t destlen)
-{
-  size_t len;
-
-  len = end - beg;
-  if (len > destlen - 1)
-    len = destlen - 1;
-  memcpy (dest, beg, len);
-  dest[len] = 0;
-  return dest;
-}
-
-char *str_substrdup(const char *begin, const char *end)
-{
-    return p_dupstr(begin, (end ? end - begin : strlen(begin)));
-}
-
-const char *str_isstr (const char *haystack, const char *needle)
-{
-  const char *p, *q;
-
-  if (!haystack)
-    return NULL;
-  if (!needle)
-    return (haystack);
-
-  while (*(p = haystack)) {
-    for (q = needle;
-         *p && *q &&
-         tolower ((unsigned char) *p) == tolower ((unsigned char) *q);
-         p++, q++);
-    if (!*q)
-      return (haystack);
-    haystack++;
-  }
-  return NULL;
-}
-
-int str_eq (const char* s1, const char* s2) {
-  int l = m_strlen(s1);
-
-  if (l != m_strlen(s2))
-    return (0);
-  return (m_strncmp(s1, s2, l) == 0);
-}
-
-void str_skip_trailws (char *s) {
-  char *p;
-
-  for (p = s + m_strlen(s) - 1; p >= s && ISSPACE (*p); p--)
-    *p = 0;
-}
diff --git a/lib/str.h b/lib/str.h
deleted file mode 100644 (file)
index b5bf82f..0000000
--- a/lib/str.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-#ifndef _LIB_STR_H
-#define _LIB_STR_H
-
-#include <sys/types.h>
-
-/*
- * tools
- */
-char *str_tolower (char*);
-char *str_substrcpy (char*, const char*, const char*, size_t);
-char *str_substrdup (const char*, const char*);
-int str_eq (const char*, const char*);
-const char *str_isstr (const char*, const char*);
-void str_skip_trailws (char*);
-
-#endif /* !_LIB_STR_H */
index 65705ca..73b2e5e 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -889,7 +889,7 @@ void mutt_save_path (char *d, size_t dsize, address_t * a)
       if ((p = strpbrk (d, "%@")))
         *p = 0;
     }
       if ((p = strpbrk (d, "%@")))
         *p = 0;
     }
-    str_tolower (d);
+    m_strtolower(d);
   }
   else
     *d = 0;
   }
   else
     *d = 0;
@@ -1070,7 +1070,7 @@ void mutt_FormatString (char *dest,     /* output buffer */
                     data, flags);
 
         if (lower)
                     data, flags);
 
         if (lower)
-          str_tolower (buf);
+          m_strtolower(buf);
         if (nodots) {
           char *p = buf;
 
         if (nodots) {
           char *p = buf;
 
index 94929bd..fe774ad 100644 (file)
@@ -265,7 +265,7 @@ const char *nntp_format_str (char *dest, size_t destlen, char op,
   switch (op) {
   case 's':
     m_strcpy(fn, sizeof (fn), NewsServer);
   switch (op) {
   case 's':
     m_strcpy(fn, sizeof (fn), NewsServer);
-    str_tolower (fn);
+    m_strtolower(fn);
     snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
     snprintf (dest, destlen, tmp, fn);
     break;
     snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
     snprintf (dest, destlen, tmp, fn);
     break;
index 2559221..34d7746 100644 (file)
@@ -159,9 +159,9 @@ static int nntp_connect_and_auth (NNTP_SERVER * serv)
   else if (!m_strncmp("201", buf, 3))
     mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
   else {
   else if (!m_strncmp("201", buf, 3))
     mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
   else {
-    mutt_socket_close (conn);
-    str_skip_trailws (buf);
-    mutt_error ("%s", buf);
+    mutt_socket_close(conn);
+    m_strrtrim(buf);
+    mutt_error("%s", buf);
     sleep (2);
     return -1;
   }
     sleep (2);
     return -1;
   }
diff --git a/parse.c b/parse.c
index eae5511..9c1195d 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1034,8 +1034,8 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
 #ifdef USE_NNTP
     else if (!m_strcasecmp(line + 1, "ollowup-to")) {
       if (!e->followup_to) {
 #ifdef USE_NNTP
     else if (!m_strcasecmp(line + 1, "ollowup-to")) {
       if (!e->followup_to) {
-        str_skip_trailws (p);
-        e->followup_to = m_strdup(vskipspaces(p));
+        m_strrtrim(p);
+        e->followup_to = m_strdup(skipspaces(p));
       }
       matched = 1;
     }
       }
       matched = 1;
     }
@@ -1078,7 +1078,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
           /* Take the first mailto URL */
           if (url_check_scheme (beg) == U_MAILTO) {
             p_delete(&e->list_post);
           /* Take the first mailto URL */
           if (url_check_scheme (beg) == U_MAILTO) {
             p_delete(&e->list_post);
-            e->list_post = str_substrdup (beg, end);
+            e->list_post = p_dupstr(beg, end - beg);
             break;
           }
         }
             break;
           }
         }
@@ -1117,8 +1117,8 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
   case 'n':
     if (!m_strcasecmp(line + 1, "ewsgroups")) {
       p_delete(&e->newsgroups);
   case 'n':
     if (!m_strcasecmp(line + 1, "ewsgroups")) {
       p_delete(&e->newsgroups);
-      str_skip_trailws (p);
-      e->newsgroups = m_strdup(vskipspaces(p));
+      m_strrtrim(p);
+      e->newsgroups = m_strdup(skipspaces(p));
       matched = 1;
     }
     break;
       matched = 1;
     }
     break;
index 66d8290..d388924 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -816,7 +816,7 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err)
         return NULL;
       }
       /* compile the sub-expression */
         return NULL;
       }
       /* compile the sub-expression */
-      buf = str_substrdup (ps.dptr + 1, p);
+      buf = p_dupstr(ps.dptr + 1, p - ps.dptr - 1);
       if ((tmp = mutt_pattern_comp (buf, flags, err)) == NULL) {
         p_delete(&buf);
         mutt_pattern_free (&curlist);
       if ((tmp = mutt_pattern_comp (buf, flags, err)) == NULL) {
         p_delete(&buf);
         mutt_pattern_free (&curlist);
index e289083..ecd789e 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -939,7 +939,7 @@ pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring)
               && !m_strcasecmp(p + 2, pgp_keyid (k)))
           || (option (OPTPGPLONGIDS) && !m_strncasecmp(p, "0x", 2)
               && !m_strcasecmp(p + 2, k->keyid + 8))
               && !m_strcasecmp(p + 2, pgp_keyid (k)))
           || (option (OPTPGPLONGIDS) && !m_strncasecmp(p, "0x", 2)
               && !m_strcasecmp(p + 2, k->keyid + 8))
-          || str_isstr (a->addr, p)) {
+          || m_stristr(a->addr, p)) {
         debug_print (5, ("match.\n"));
         match = 1;
         break;
         debug_print (5, ("match.\n"));
         match = 1;
         break;
index da1e4cd..bb27da1 100644 (file)
@@ -706,7 +706,7 @@ static int pgpring_string_matches_hint (const char *s, const char *hints[],
     return 1;
 
   for (i = 0; i < nhints; i++) {
     return 1;
 
   for (i = 0; i < nhints; i++) {
-    if (str_isstr (s, hints[i]) != NULL)
+    if (m_stristr(s, hints[i]) != NULL)
       return 1;
   }
 
       return 1;
   }
 
index e34165b..fae3c9b 100644 (file)
@@ -74,7 +74,7 @@ void pop_error (POP_DATA * pop_data, char *msg)
   }
 
   m_strcpy(t, sizeof(pop_data->err_msg) - strlen(pop_data->err_msg), c);
   }
 
   m_strcpy(t, sizeof(pop_data->err_msg) - strlen(pop_data->err_msg), c);
-  str_skip_trailws (pop_data->err_msg);
+  m_strrtrim(pop_data->err_msg);
 }
 
 /* Parse CAPA output */
 }
 
 /* Parse CAPA output */
index 3cea0a8..9b745b4 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -132,7 +132,7 @@ static char *get_field (char *s)
       break;
     }
   }
       break;
     }
   }
-  str_skip_trailws (s);
+  m_strrtrim(s);
   return ch;
 }
 
   return ch;
 }
 
index 1762394..761054b 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -744,7 +744,7 @@ static size_t convert_file_from_to (FILE * file,
   for (c = tocodes, i = 0; c; c = c1 ? c1 + 1 : 0, i++) {
     if ((c1 = strchr (c, ':')) == c)
       continue;
   for (c = tocodes, i = 0; c; c = c1 ? c1 + 1 : 0, i++) {
     if ((c1 = strchr (c, ':')) == c)
       continue;
-    tcode[i] = str_substrdup (c, c1);
+    tcode[i] = m_substrdup(c, c1);
   }
 
   ret = (size_t) (-1);
   }
 
   ret = (size_t) (-1);
@@ -753,7 +753,7 @@ static size_t convert_file_from_to (FILE * file,
     for (c = fromcodes; c; c = c1 ? c1 + 1 : 0) {
       if ((c1 = strchr (c, ':')) == c)
         continue;
     for (c = fromcodes; c; c = c1 ? c1 + 1 : 0) {
       if ((c1 = strchr (c, ':')) == c)
         continue;
-      fcode = str_substrdup (c, c1);
+      fcode = m_substrdup(c, c1);
 
       ret = convert_file_to (file, fcode, ncodes, (const char **) tcode,
                              &cn, info);
 
       ret = convert_file_to (file, fcode, ncodes, (const char **) tcode,
                              &cn, info);
@@ -937,7 +937,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
 
             for (q = p; *q && !ISSPACE (*q); q++);
 
 
             for (q = p; *q && !ISSPACE (*q); q++);
 
-            str_substrcpy (subtype, p, q, sizeof (subtype));
+            m_strncpy(subtype, sizeof(subtype), p, q - p);
 
             if ((type = mutt_check_mime_type (ct)) == TYPEOTHER)
               m_strcpy(xtype, sizeof(xtype), ct);
 
             if ((type = mutt_check_mime_type (ct)) == TYPEOTHER)
               m_strcpy(xtype, sizeof(xtype), ct);
index ab95a22..5ce1922 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -102,7 +102,7 @@ static const char* sidebar_number_format (char* dest, size_t destlen, char op,
   char tmp[SHORT_STRING];
   BUFFY* b = (BUFFY*) Incoming->data[data];
   int opt = flags & M_FORMAT_OPTIONAL;
   char tmp[SHORT_STRING];
   BUFFY* b = (BUFFY*) Incoming->data[data];
   int opt = flags & M_FORMAT_OPTIONAL;
-  int c = Context && str_eq (Context->path, b->path);
+  int c = Context && !m_strcmp(Context->path, b->path);
 
   switch (op) {
     /* deleted */
 
   switch (op) {
     /* deleted */
@@ -199,7 +199,7 @@ int make_sidebar_entry (char* box, int idx, size_t len)
     SidebarWidth = COLS;
 
   if (option (OPTSIDEBARNEWMAILONLY) && box && Context && Context->path && 
     SidebarWidth = COLS;
 
   if (option (OPTSIDEBARNEWMAILONLY) && box && Context && Context->path && 
-      !str_eq (Context->path, box) && ((BUFFY*) Incoming->data[idx])->new == 0)
+      m_strcmp(Context->path, box) && ((BUFFY*) Incoming->data[idx])->new == 0)
     /* if $sidebar_newmail_only is set, don't display the
      * box only if it's not the currently opened
      * (i.e. always display the currently opened) */
     /* if $sidebar_newmail_only is set, don't display the
      * box only if it's not the currently opened
      * (i.e. always display the currently opened) */
diff --git a/smime.c b/smime.c
index 3db7185..804ba95 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -414,7 +414,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
         continue;
 
       /* Check if query matches this certificate */
         continue;
 
       /* Check if query matches this certificate */
-      if (!str_isstr (fields[0], qry) && !str_isstr (fields[2], qry))
+      if (!m_stristr(fields[0], qry) && !m_stristr(fields[2], qry))
         continue;
 
       Table[cur].hash = hash;
         continue;
 
       Table[cur].hash = hash;