Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sun, 3 Apr 2005 13:07:25 +0000 (13:07 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sun, 3 Apr 2005 13:07:25 +0000 (13:07 +0000)
move string helper functions to internal naming convention (more of this "modularization" to come)

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@246 e385b8ad-14ed-0310-8656-cc95a2468c6d

92 files changed:
account.c
addrbook.c
alias.c
ascii.h
attach.c
browser.c
buffy.c
charset.c
color.c
commands.c
complete.c
compose.c
compress.c
copy.c
crypt-gpgme.c
crypt.c
curs_lib.c
curs_main.c
dotlock.c
edit.c
enter.c
from.c
getdomain.c
gnupgparse.c
handler.c
hash.c
hcache.c
hdrline.c
headers.c
help.c
history.c
hook.c
imap/auth_cram.c
imap/auth_gss.c
imap/auth_sasl.c
imap/browse.c
imap/command.c
imap/imap.c
imap/message.c
imap/utf7.c
imap/util.c
init.c
keymap.c
lib.c
lib.h
lib/rx.c
lib/str.c
lib/str.h
main.c
mbox.c
menu.c
mh.c
mutt_idna.c
mutt_libesmtp.c
mutt_sasl.c
mutt_socket.c
mutt_ssl.c
mutt_ssl_gnutls.c
mutt_ssl_nss.c
muttlib.c
mx.c
nntp/newsrc.c
nntp/nntp.c
pager.c
parse.c
pattern.c
pgp.c
pgpkey.c
pgpmicalg.c
pgppubring.c
pop/pop.c
pop/pop_auth.c
pop/pop_lib.c
postpone.c
query.c
recvattach.c
recvcmd.c
remailer.c
rfc1524.c
rfc2047.c
rfc2231.c
rfc822.c
score.c
send.c
sendlib.c
sidebar.c
smime.c
snprintf.c
sort.c
status.c
thread.c
url.c

index ab8bb7e..33e64b2 100644 (file)
--- a/account.c
+++ b/account.c
@@ -49,11 +49,11 @@ int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2)
 #endif
 
   if (a1->flags & a2->flags & M_ACCT_USER)
-    return (!mutt_strcmp (a1->user, a2->user));
+    return (!safe_strcmp (a1->user, a2->user));
   if (a1->flags & M_ACCT_USER)
-    return (!mutt_strcmp (a1->user, user));
+    return (!safe_strcmp (a1->user, user));
   if (a2->flags & M_ACCT_USER)
-    return (!mutt_strcmp (a2->user, user));
+    return (!safe_strcmp (a2->user, user));
 
   return 1;
 }
index df5003c..6d34f74 100644 (file)
@@ -94,7 +94,7 @@ static int alias_SortAlias (const void *a, const void *b)
 {
   ALIAS *pa = *(ALIAS **) a;
   ALIAS *pb = *(ALIAS **) b;
-  int r = mutt_strcasecmp (pa->name, pb->name);
+  int r = safe_strcasecmp (pa->name, pb->name);
 
   return (RSORT (r));
 }
@@ -113,7 +113,7 @@ static int alias_SortAddress (const void *a, const void *b)
     r = 1;
   else if (pa->personal) {
     if (pb->personal)
-      r = mutt_strcasecmp (pa->personal, pb->personal);
+      r = safe_strcasecmp (pa->personal, pb->personal);
     else
       r = 1;
   }
diff --git a/alias.c b/alias.c
index f092a8c..a41c8d8 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -28,7 +28,7 @@ ADDRESS *mutt_lookup_alias (const char *s)
   ALIAS *t = Aliases;
 
   for (; t; t = t->next)
-    if (!mutt_strcasecmp (s, t->name))
+    if (!safe_strcasecmp (s, t->name))
       return (t->addr);
   return (NULL);                /* no such alias */
 }
@@ -48,7 +48,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS * a, LIST ** expn)
       if (t) {
         i = 0;
         for (u = *expn; u; u = u->next) {
-          if (mutt_strcmp (a->mailbox, u->data) == 0) { /* alias already found */
+          if (safe_strcmp (a->mailbox, u->data) == 0) { /* alias already found */
             dprint (1,
                     (debugfile,
                      "mutt_expand_aliases_r(): loop in alias found for '%s'\n",
@@ -85,7 +85,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS * a, LIST ** expn)
           char namebuf[STRING];
 
           mutt_gecos_name (namebuf, sizeof (namebuf), pw);
-          mutt_str_replace (&a->personal, namebuf);
+          str_replace (&a->personal, namebuf);
 
 #ifdef EXACT_ADDRESS
           FREE (&a->val);
@@ -398,7 +398,7 @@ int mutt_alias_complete (char *s, size_t buflen)
       if (a->name && strstr (a->name, s) == a->name) {
         if (!bestname[0])       /* init */
           strfcpy (bestname, a->name,
-                   min (mutt_strlen (a->name) + 1, sizeof (bestname)));
+                   min (safe_strlen (a->name) + 1, sizeof (bestname)));
         else {
           for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++);
           bestname[i] = 0;
@@ -408,9 +408,9 @@ int mutt_alias_complete (char *s, size_t buflen)
     }
 
     if (bestname[0] != 0) {
-      if (mutt_strcmp (bestname, s) != 0) {
+      if (safe_strcmp (bestname, s) != 0) {
         /* we are adding something to the completion */
-        strfcpy (s, bestname, mutt_strlen (bestname) + 1);
+        strfcpy (s, bestname, safe_strlen (bestname) + 1);
         return 1;
       }
 
diff --git a/ascii.h b/ascii.h
index 756edd8..4074ca3 100644 (file)
--- a/ascii.h
+++ b/ascii.h
@@ -22,7 +22,7 @@ int ascii_tolower (int c);
 int ascii_strcasecmp (const char *a, const char *b);
 int ascii_strncasecmp (const char *a, const char *b, int n);
 
-#define ascii_strcmp(a,b) mutt_strcmp(a,b)
-#define ascii_strncmp(a,b,c) mutt_strncmp(a,b,c)
+#define ascii_strcmp(a,b) safe_strcmp(a,b)
+#define ascii_strncmp(a,b,c) safe_strncmp(a,b,c)
 
 #endif
index 6976f6e..146c938 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -60,7 +60,7 @@ int mutt_get_tmp_attachment (BODY * a)
 
   if ((fpin = fopen (a->filename, "r")) && (fpout = safe_fopen (tempfile, "w"))) {      /* __FOPEN_CHECKED__ */
     mutt_copy_stream (fpin, fpout);
-    mutt_str_replace (&a->filename, tempfile);
+    str_replace (&a->filename, tempfile);
     a->unlink = 1;
 
     if (a->stamp >= st.st_mtime)
@@ -274,7 +274,7 @@ static int is_mmnoask (const char *buf)
   int lng;
 
   if ((p = getenv ("MM_NOASK")) != NULL && *p) {
-    if (mutt_strcmp (p, "1") == 0)
+    if (safe_strcmp (p, "1") == 0)
       return (1);
 
     strfcpy (tmp, p, sizeof (tmp));
@@ -292,8 +292,8 @@ static int is_mmnoask (const char *buf)
         }
       }
       else {
-        lng = mutt_strlen (p);
-        if (buf[lng] == '/' && mutt_strncasecmp (buf, p, lng) == 0)
+        lng = safe_strlen (p);
+        if (buf[lng] == '/' && safe_strncasecmp (buf, p, lng) == 0)
           return (1);
       }
 
@@ -310,7 +310,7 @@ void mutt_check_lookup_list (BODY * b, char *type, int len)
   int i;
 
   for (; t; t = t->next) {
-    i = mutt_strlen (t->data) - 1;
+    i = safe_strlen (t->data) - 1;
     if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' &&
          ascii_strncasecmp (type, t->data, i) == 0) ||
         ascii_strcasecmp (type, t->data) == 0) {
@@ -362,7 +362,7 @@ int mutt_is_autoview (BODY * b, const char *type)
   }
 
   for (; t; t = t->next) {
-    i = mutt_strlen (t->data) - 1;
+    i = safe_strlen (t->data) - 1;
     if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' &&
          ascii_strncasecmp (type, t->data, i) == 0) ||
         ascii_strcasecmp (type, t->data) == 0)
@@ -431,7 +431,7 @@ int mutt_view_attachment (FILE * fp, BODY * a, int flag, HEADER * hdr,
 
     if (rfc1524_expand_filename (entry->nametemplate, fname,
                                  tempfile, sizeof (tempfile))) {
-      if (fp == NULL && mutt_strcmp (tempfile, a->filename)) {
+      if (fp == NULL && safe_strcmp (tempfile, a->filename)) {
         /* send case: the file is already there */
         if (safe_symlink (a->filename, tempfile) == -1) {
           if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES)
index 1dbc644..f509f02 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -90,7 +90,7 @@ static int browser_compare_subject (const void *a, const void *b)
   struct folder_file *pa = (struct folder_file *) a;
   struct folder_file *pb = (struct folder_file *) b;
 
-  int r = mutt_strcoll (pa->name, pb->name);
+  int r = safe_strcoll (pa->name, pb->name);
 
   return ((BrowserSort & SORT_REVERSE) ? -r : r);
 }
@@ -484,7 +484,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state,
       if (!(data = (NNTP_DATA *) tmp->data))
         continue;
       if (prefix && *prefix && strncmp (prefix, data->group,
-                                        mutt_strlen (prefix)) != 0)
+                                        safe_strlen (prefix)) != 0)
         continue;
       if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
         continue;
@@ -529,11 +529,11 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state,
     init_state (state, menu);
 
     while ((de = readdir (dp)) != NULL) {
-      if (mutt_strcmp (de->d_name, ".") == 0)
+      if (safe_strcmp (de->d_name, ".") == 0)
         continue;               /* we don't need . */
 
       if (prefix && *prefix
-          && mutt_strncmp (prefix, de->d_name, mutt_strlen (prefix)) != 0)
+          && safe_strncmp (prefix, de->d_name, safe_strlen (prefix)) != 0)
         continue;
       if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
         continue;
@@ -773,7 +773,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
     }
     else {
 #endif
-      for (i = mutt_strlen (f) - 1; i > 0 && f[i] != '/'; i--);
+      for (i = safe_strlen (f) - 1; i > 0 && f[i] != '/'; i--);
       if (i > 0) {
         if (f[0] == '/') {
           if (i > sizeof (LastDir) - 1)
@@ -889,8 +889,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
           /* save the old directory */
           strfcpy (OldLastDir, LastDir, sizeof (OldLastDir));
 
-          if (mutt_strcmp (state.entry[menu->current].name, "..") == 0) {
-            if (mutt_strcmp ("..", LastDir + mutt_strlen (LastDir) - 2) == 0)
+          if (safe_strcmp (state.entry[menu->current].name, "..") == 0) {
+            if (safe_strcmp ("..", LastDir + safe_strlen (LastDir) - 2) == 0)
               strcat (LastDir, "/..");  /* __STRCAT_CHECKED__ */
             else {
               char *p = strrchr (LastDir + 1, '/');
@@ -918,7 +918,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
             strfcpy (LastDir, state.entry[menu->current].name,
                      sizeof (LastDir));
             /* tack on delimiter here */
-            n = mutt_strlen (LastDir) + 1;
+            n = safe_strlen (LastDir) + 1;
 
             /* special case "" needs no delimiter */
             url_parse_ciss (&url, state.entry[menu->current].name);
@@ -1123,7 +1123,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
 #endif
       {
         /* add '/' at the end of the directory name if not already there */
-        int len = mutt_strlen (LastDir);
+        int len = safe_strlen (LastDir);
 
         if (len && LastDir[len - 1] != '/' && sizeof (buf) > len)
           buf[len] = '/';
@@ -1199,7 +1199,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
           mutt_error ("%s", buf);
         }
         else {
-          mutt_str_replace (&Mask.pattern, buf);
+          str_replace (&Mask.pattern, buf);
           regfree (Mask.rx);
           FREE (&Mask.rx);
           Mask.rx = rx;
diff --git a/buffy.c b/buffy.c
index a6436c2..9c861b0 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -71,13 +71,13 @@ int fseek_last_message (FILE * f)
    * reads will be on block boundaries, which might increase efficiency.  */
   while ((pos -= bytes_read) >= 0) {
     /* we save in the buffer at the end the first 7 chars from the last read */
-    strncpy (buffer + BUFSIZ, buffer, 5 + 2);   /* 2 == 2 * mutt_strlen(CRLF) */
+    strncpy (buffer + BUFSIZ, buffer, 5 + 2);   /* 2 == 2 * safe_strlen(CRLF) */
     fseek (f, pos, SEEK_SET);
     bytes_read = fread (buffer, sizeof (char), bytes_read, f);
     if (bytes_read == -1)
       return -1;
     for (i = bytes_read; --i >= 0;)
-      if (!mutt_strncmp (buffer + i, "\n\nFrom ", mutt_strlen ("\n\nFrom "))) { /* found it - go to the beginning of the From */
+      if (!safe_strncmp (buffer + i, "\n\nFrom ", safe_strlen ("\n\nFrom "))) { /* found it - go to the beginning of the From */
         fseek (f, pos + i + 2, SEEK_SET);
         return 0;
       }
@@ -85,7 +85,7 @@ int fseek_last_message (FILE * f)
   }
 
   /* here we are at the beginning of the file */
-  if (!mutt_strncmp ("From ", buffer, 5)) {
+  if (!safe_strncmp ("From ", buffer, 5)) {
     fseek (f, 0, 0);
     return (0);
   }
@@ -178,7 +178,7 @@ int buffy_lookup (const char* path) {
   if (list_empty(Incoming) || !path || !*path)
     return (-1);
   for (i = 0; i < Incoming->length; i++) {
-    if (mutt_strcmp (((BUFFY*) Incoming->data[i])->path, path) == 0)
+    if (safe_strcmp (((BUFFY*) Incoming->data[i])->path, path) == 0)
       return (i);
   }
   return (-1);
@@ -198,7 +198,7 @@ int mutt_parse_mailboxes (BUFFER * path, BUFFER * s, unsigned long data,
     mutt_extract_token (path, s, 0);
     strfcpy (buf, path->data, sizeof (buf));
 
-    if (data == M_UNMAILBOXES && mutt_strcmp (buf, "*") == 0) {
+    if (data == M_UNMAILBOXES && safe_strcmp (buf, "*") == 0) {
       list_del (&Incoming, buffy_free);
       return 0;
     }
@@ -360,7 +360,7 @@ int mutt_buffy_check (int force)
 #ifdef USE_NNTP
                                         || tmp->magic == M_NNTP
 #endif
-                                       )? mutt_strcmp (tmp->path,
+                                       )? safe_strcmp (tmp->path,
                                                        Context->path) : (sb.
                                                                          st_dev
                                                                          !=
@@ -563,7 +563,7 @@ int mutt_buffy_list (void)
   pos = 0;
   first = 1;
   buffylist[0] = 0;
-  pos += mutt_strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
+  pos += safe_strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */
   if (Incoming) {
     for (i = 0; i < Incoming->length; i++) {
       tmp = (BUFFY*) Incoming->data[i];
@@ -574,19 +574,19 @@ int mutt_buffy_list (void)
       strfcpy (path, tmp->path, sizeof (path));
       mutt_pretty_mailbox (path);
 
-      if (!first && pos + mutt_strlen (path) >= COLS - 7)
+      if (!first && pos + safe_strlen (path) >= COLS - 7)
         break;
 
       if (!first)
-        pos += mutt_strlen (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos));    /* __STRNCAT_CHECKED__ */
+        pos += safe_strlen (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos));    /* __STRNCAT_CHECKED__ */
 
       /* Prepend an asterisk to mailboxes not already notified */
       if (!tmp->notified) {
-        /* pos += mutt_strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos));  __STRNCAT_CHECKED__ */
+        /* pos += safe_strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos));  __STRNCAT_CHECKED__ */
         tmp->notified = 1;
         BuffyNotify--;
       }
-      pos += mutt_strlen (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos));      /* __STRNCAT_CHECKED__ */
+      pos += safe_strlen (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos));      /* __STRNCAT_CHECKED__ */
       first = 0;
     }
   }
index 1bc0795..4bae308 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -228,7 +228,7 @@ void mutt_canonical_charset (char *dest, size_t dlen, const char *name)
 
   for (i = 0; PreferredMIMENames[i].key; i++)
     if (!ascii_strcasecmp (scratch, PreferredMIMENames[i].key) ||
-        !mutt_strcasecmp (scratch, PreferredMIMENames[i].key)) {
+        !safe_strcasecmp (scratch, PreferredMIMENames[i].key)) {
       strfcpy (dest, PreferredMIMENames[i].pref, dlen);
       return;
     }
@@ -335,7 +335,7 @@ size_t mutt_iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t * inbytesleft,
 
         for (t = inrepls; *t; t++) {
           ICONV_CONST char *ib1 = *t;
-          size_t ibl1 = mutt_strlen (*t);
+          size_t ibl1 = safe_strlen (*t);
           char *ob1 = ob;
           size_t obl1 = obl;
 
@@ -355,7 +355,7 @@ size_t mutt_iconv (iconv_t cd, ICONV_CONST char **inbuf, size_t * inbytesleft,
         outrepl = "?";
       iconv (cd, 0, 0, &ob, &obl);
       if (obl) {
-        int n = mutt_strlen (outrepl);
+        int n = safe_strlen (outrepl);
 
         if (n > obl) {
           outrepl = "?";
@@ -406,7 +406,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to,
     else
       outrepl = "?";
 
-    len = mutt_strlen (s);
+    len = safe_strlen (s);
     ib = s, ibl = len + 1;
     obl = MB_LEN_MAX * ibl;
     ob = buf = safe_malloc (obl + 1);
@@ -419,7 +419,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to,
     FREE (ps);
     *ps = buf;
 
-    mutt_str_adjust (ps);
+    str_adjust (ps);
     return 0;
   }
   else
@@ -561,7 +561,7 @@ char *mutt_get_first_charset (const char *charset)
   const char *c, *c1;
 
   c = charset;
-  if (!mutt_strlen (c))
+  if (!safe_strlen (c))
     return "us-ascii";
   if (!(c1 = strchr (c, ':')))
     return charset;
@@ -611,14 +611,14 @@ int mutt_convert_nonmime_string (char **ps)
     char *s;
     char *fromcode;
     size_t m, n;
-    size_t ulen = mutt_strlen (*ps);
+    size_t ulen = safe_strlen (*ps);
     size_t slen;
 
     if (!u || !*u)
       return 0;
 
     c1 = strchr (c, ':');
-    n = c1 ? c1 - c : mutt_strlen (c);
+    n = c1 ? c1 - c : safe_strlen (c);
     if (!n)
       continue;
     fromcode = safe_malloc (n + 1);
diff --git a/color.c b/color.c
index 87c7ded..69e444e 100644 (file)
--- a/color.c
+++ b/color.c
@@ -297,13 +297,13 @@ parse_color_name (const char *s, int *col, int *attr, int brite, BUFFER * err)
 {
   char *eptr;
 
-  if (mutt_strncasecmp (s, "bright", 6) == 0) {
+  if (safe_strncasecmp (s, "bright", 6) == 0) {
     *attr |= brite;
     s += 6;
   }
 
   /* allow aliases for xterm color resources */
-  if (mutt_strncasecmp (s, "color", 5) == 0) {
+  if (safe_strncasecmp (s, "color", 5) == 0) {
     s += 5;
     *col = strtol (s, &eptr, 10);
     if (!*s || *eptr || *col < 0 ||
@@ -363,7 +363,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
     return (-1);
   }
 
-  if (mutt_strncmp (buf->data, "index", 5) != 0) {
+  if (safe_strncmp (buf->data, "index", 5) != 0) {
     snprintf (err->data, err->dsize,
               _("%s: command valid only for index object"),
               parse_uncolor ? "uncolor" : "unmono");
@@ -401,7 +401,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
 
   do {
     mutt_extract_token (buf, s, 0);
-    if (!mutt_strcmp ("*", buf->data)) {
+    if (!safe_strcmp ("*", buf->data)) {
       for (tmp = ColorIndexList; tmp;) {
         if (!do_cache)
           do_cache = 1;
@@ -414,7 +414,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
     else {
       for (last = NULL, tmp = ColorIndexList; tmp;
            last = tmp, tmp = tmp->next) {
-        if (!mutt_strcmp (buf->data, tmp->pattern)) {
+        if (!safe_strcmp (buf->data, tmp->pattern)) {
           if (!do_cache)
             do_cache = 1;
           dprint (1,
@@ -458,11 +458,11 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive,
 
   while (tmp) {
     if (sensitive) {
-      if (mutt_strcmp (s, tmp->pattern) == 0)
+      if (safe_strcmp (s, tmp->pattern) == 0)
         break;
     }
     else {
-      if (mutt_strcasecmp (s, tmp->pattern) == 0)
+      if (safe_strcasecmp (s, tmp->pattern) == 0)
         break;
     }
     tmp = tmp->next;
@@ -538,7 +538,7 @@ parse_object (BUFFER * buf, BUFFER * s, int *o, int *ql, BUFFER * err)
   }
 
   mutt_extract_token (buf, s, 0);
-  if (!mutt_strncmp (buf->data, "quoted", 6)) {
+  if (!safe_strncmp (buf->data, "quoted", 6)) {
     if (buf->data[6]) {
       *ql = strtol (buf->data + 6, &eptr, 10);
       if (*eptr || q_level < 0) {
index cc157fc..6bef579 100644 (file)
@@ -123,7 +123,7 @@ int mutt_display_message (HEADER * cur)
     }
   }
 
-  if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
+  if (!Pager || safe_strcmp (Pager, "builtin") == 0)
     builtin = 1;
   else {
     mutt_make_string (buf, sizeof (buf), NONULL (PagerFmt), Context, cur);
@@ -724,7 +724,7 @@ int mutt_save_message (HEADER * h, int delete,
   /* This is an undocumented feature of ELM pointed out to me by Felix von
    * Leitner <leitner@prz.fu-berlin.de>
    */
-  if (mutt_strcmp (buf, ".") == 0)
+  if (safe_strcmp (buf, ".") == 0)
     strfcpy (buf, LastSaveFolder, sizeof (buf));
   else
     strfcpy (LastSaveFolder, buf, sizeof (LastSaveFolder));
@@ -849,7 +849,7 @@ int mutt_update_list_file (char *filename, char *section, char *key,
       while (*c && *c != '\n')
         c++;
       c[0] = 0;                 /* strip EOL */
-      if (!strncmp (buf, "#: ", 3) && !mutt_strcasecmp (buf + 3, section))
+      if (!strncmp (buf, "#: ", 3) && !safe_strcasecmp (buf + 3, section))
         done++;
     }
     if (r != EOF && !done) {
@@ -877,8 +877,8 @@ int mutt_update_list_file (char *filename, char *section, char *key,
       done++;
       break;
     }
-    else if (key && !strncmp (buf, key, mutt_strlen (key)) &&
-             (!*key || buf[mutt_strlen (key)] == ' ')) {
+    else if (key && !strncmp (buf, key, safe_strlen (key)) &&
+             (!*key || buf[safe_strlen (key)] == ' ')) {
       c = buf;
       ext = 0;
       while (*c && (*c != '\r') && (*c != '\n'))
@@ -947,7 +947,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
     size_t l;
 
     for (p = b->parameter; p; p = p->next) {
-      l = mutt_strlen (buf);
+      l = safe_strlen (buf);
 
       rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
       snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
index 1066b5c..f26691e 100644 (file)
@@ -59,7 +59,7 @@ int mutt_complete (char *s, size_t slen)
      * special case to handle when there is no filepart yet.
      * find the first subscribed newsgroup
      */
-    if ((len = mutt_strlen (filepart)) == 0) {
+    if ((len = safe_strlen (filepart)) == 0) {
       for (; l; l = l->next) {
         NNTP_DATA *data = (NNTP_DATA *) l->data;
 
@@ -76,7 +76,7 @@ int mutt_complete (char *s, size_t slen)
       NNTP_DATA *data = (NNTP_DATA *) l->data;
 
       if (data && data->subscribed &&
-          mutt_strncmp (data->group, filepart, len) == 0) {
+          safe_strncmp (data->group, filepart, len) == 0) {
         if (init) {
           for (i = 0; filepart[i] && data->group[i]; i++) {
             if (filepart[i] != data->group[i]) {
@@ -177,10 +177,10 @@ int mutt_complete (char *s, size_t slen)
    * special case to handle when there is no filepart yet.  find the first
    * file/directory which is not ``.'' or ``..''
    */
-  if ((len = mutt_strlen (filepart)) == 0) {
+  if ((len = safe_strlen (filepart)) == 0) {
     while ((de = readdir (dirp)) != NULL) {
-      if (mutt_strcmp (".", de->d_name) != 0
-          && mutt_strcmp ("..", de->d_name) != 0) {
+      if (safe_strcmp (".", de->d_name) != 0
+          && safe_strcmp ("..", de->d_name) != 0) {
         strfcpy (filepart, de->d_name, sizeof (filepart));
         init++;
         break;
@@ -189,7 +189,7 @@ int mutt_complete (char *s, size_t slen)
   }
 
   while ((de = readdir (dirp)) != NULL) {
-    if (mutt_strncmp (de->d_name, filepart, len) == 0) {
+    if (safe_strncmp (de->d_name, filepart, len) == 0) {
       if (init) {
         for (i = 0; filepart[i] && de->d_name[i]; i++) {
           if (filepart[i] != de->d_name[i]) {
@@ -208,14 +208,14 @@ int mutt_complete (char *s, size_t slen)
         /* check to see if it is a directory */
         if (dirpart[0]) {
           strfcpy (buf, exp_dirpart, sizeof (buf));
-          strfcpy (buf + mutt_strlen (buf), "/", sizeof (buf) - mutt_strlen (buf));
+          strfcpy (buf + safe_strlen (buf), "/", sizeof (buf) - safe_strlen (buf));
         }
         else
           buf[0] = 0;
-        strfcpy (buf + mutt_strlen (buf), filepart, sizeof (buf) - mutt_strlen (buf));
+        strfcpy (buf + safe_strlen (buf), filepart, sizeof (buf) - safe_strlen (buf));
         if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
-          strfcpy (filepart + mutt_strlen (filepart), "/",
-                   sizeof (filepart) - mutt_strlen (filepart));
+          strfcpy (filepart + safe_strlen (filepart), "/",
+                   sizeof (filepart) - safe_strlen (filepart));
         init = 1;
       }
     }
@@ -224,10 +224,10 @@ int mutt_complete (char *s, size_t slen)
 
   if (dirpart[0]) {
     strfcpy (s, dirpart, slen);
-    if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '='
+    if (safe_strcmp ("/", dirpart) != 0 && dirpart[0] != '='
         && dirpart[0] != '+')
-      strfcpy (s + mutt_strlen (s), "/", slen - mutt_strlen (s));
-    strfcpy (s + mutt_strlen (s), filepart, slen - mutt_strlen (s));
+      strfcpy (s + safe_strlen (s), "/", slen - safe_strlen (s));
+    strfcpy (s + safe_strlen (s), filepart, slen - safe_strlen (s));
   }
   else
     strfcpy (s, filepart, slen);
index 86004f2..a511eb4 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -221,14 +221,14 @@ static void redraw_mix_line (LIST * chain)
     if (t && t[0] == '0' && t[1] == '\0')
       t = "<random>";
 
-    if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
+    if (c + safe_strlen (t) + 2 >= COLS - SidebarWidth)
       break;
 
     addstr (NONULL (t));
     if (chain->next)
       addstr (", ");
 
-    c += mutt_strlen (t) + 2;
+    c += safe_strlen (t) + 2;
   }
 }
 #endif /* MIXMASTER */
@@ -669,7 +669,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
       else
         buf[0] = 0;
       if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
-        mutt_str_replace (&msg->env->subject, buf);
+        str_replace (&msg->env->subject, buf);
         move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
         clrtoeol ();
         if (msg->env->subject)
@@ -694,7 +694,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
       mutt_message_hook (NULL, msg, M_SEND2HOOK);
       break;
     case OP_COMPOSE_EDIT_MESSAGE:
-      if (Editor && (mutt_strcmp ("builtin", Editor) != 0)
+      if (Editor && (safe_strcmp ("builtin", Editor) != 0)
           && !option (OPTEDITHDRS)) {
         mutt_edit_file (Editor, msg->content->filename);
         mutt_update_encoding (msg->content);
@@ -704,7 +704,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
       }
       /* fall through */
     case OP_COMPOSE_EDIT_HEADERS:
-      if (mutt_strcmp ("builtin", Editor) != 0 &&
+      if (safe_strcmp ("builtin", Editor) != 0 &&
           (op == OP_COMPOSE_EDIT_HEADERS ||
            (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) {
         char *tag = NULL, *err = NULL;
@@ -998,7 +998,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
                idx[menu->current]->content->description : "", sizeof (buf));
       /* header names should not be translated */
       if (mutt_get_field ("Description: ", buf, sizeof (buf), 0) == 0) {
-        mutt_str_replace (&idx[menu->current]->content->description, buf);
+        str_replace (&idx[menu->current]->content->description, buf);
         menu->redraw = REDRAW_CURRENT;
       }
       mutt_message_hook (NULL, msg, M_SEND2HOOK);
@@ -1146,7 +1146,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         if (mutt_rename_file (idx[menu->current]->content->filename, fname))
           break;
 
-        mutt_str_replace (&idx[menu->current]->content->filename, fname);
+        str_replace (&idx[menu->current]->content->filename, fname);
         menu->redraw = REDRAW_CURRENT;
 
         if (idx[menu->current]->content->stamp >= st.st_mtime)
@@ -1208,7 +1208,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         update_idx (menu, idx, idxlen++);
 
         idx[menu->current]->content->type = itype;
-        mutt_str_replace (&idx[menu->current]->content->subtype, p);
+        str_replace (&idx[menu->current]->content->subtype, p);
         idx[menu->current]->content->unlink = 1;
         menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
 
index d7c2279..c3ddf2d 100644 (file)
@@ -129,7 +129,7 @@ static void set_path (CONTEXT * ctx)
 
   /* Uncompress to /tmp */
   mutt_mktemp (tmppath);
-  ctx->path = safe_malloc (mutt_strlen (tmppath) + 1);
+  ctx->path = safe_malloc (safe_strlen (tmppath) + 1);
   strcpy (ctx->path, tmppath);
 }
 
diff --git a/copy.c b/copy.c
index 37e69c8..beb0d59 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -72,7 +72,7 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
       /* Is it the begining of a header? */
       if (nl && buf[0] != ' ' && buf[0] != '\t') {
         ignore = 1;
-        if (!from && mutt_strncmp ("From ", buf, 5) == 0) {
+        if (!from && safe_strncmp ("From ", buf, 5) == 0) {
           if ((flags & CH_FROM) == 0)
             continue;
           from = 1;
@@ -146,8 +146,8 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
         if (!headers[x])
           headers[x] = this_one;
         else {
-          safe_realloc (&headers[x], mutt_strlen (headers[x]) +
-                        mutt_strlen (this_one) + sizeof (char));
+          safe_realloc (&headers[x], safe_strlen (headers[x]) +
+                        safe_strlen (this_one) + sizeof (char));
           strcat (headers[x], this_one);        /* __STRCAT_CHECKED__ */
           FREE (&this_one);
         }
@@ -157,7 +157,7 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
 
       ignore = 1;
       this_is_from = 0;
-      if (!from && mutt_strncmp ("From ", buf, 5) == 0) {
+      if (!from && safe_strncmp ("From ", buf, 5) == 0) {
         if ((flags & CH_FROM) == 0)
           continue;
         this_is_from = from = 1;
@@ -198,7 +198,7 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
       /* Find x -- the array entry where this header is to be saved */
       if (flags & CH_REORDER) {
         for (t = HeaderOrderList, x = 0; (t); t = t->next, x++) {
-          if (!ascii_strncasecmp (buf, t->data, mutt_strlen (t->data))) {
+          if (!ascii_strncasecmp (buf, t->data, safe_strlen (t->data))) {
             dprint (2, (debugfile, "Reorder: %s matches %s\n", t->data, buf));
             break;
           }
@@ -215,7 +215,7 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
         this_one = safe_strdup (buf);
       else {
         safe_realloc (&this_one,
-                      mutt_strlen (this_one) + mutt_strlen (buf) +
+                      safe_strlen (this_one) + safe_strlen (buf) +
                       sizeof (char));
         strcat (this_one, buf); /* __STRCAT_CHECKED__ */
       }
@@ -232,8 +232,8 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
     if (!headers[x])
       headers[x] = this_one;
     else {
-      safe_realloc (&headers[x], mutt_strlen (headers[x]) +
-                    mutt_strlen (this_one) + sizeof (char));
+      safe_realloc (&headers[x], safe_strlen (headers[x]) +
+                    safe_strlen (this_one) + sizeof (char));
       strcat (headers[x], this_one);    /* __STRCAT_CHECKED__ */
       FREE (&this_one);
     }
@@ -521,12 +521,12 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body,
       char date[SHORT_STRING];
 
       mutt_make_date (date, sizeof (date));
-      date[5] = date[mutt_strlen (date) - 1] = '\"';
+      date[5] = date[safe_strlen (date) - 1] = '\"';
 
       /* Count the number of lines and bytes to be deleted */
       fseek (fpin, body->offset, SEEK_SET);
       new_lines = hdr->lines -
-        count_delete_lines (fpin, body, &new_length, mutt_strlen (date));
+        count_delete_lines (fpin, body, &new_length, safe_strlen (date));
 
       /* Copy the headers */
       if (mutt_copy_header (fpin, hdr, fpout,
@@ -805,7 +805,7 @@ static void format_address_header (char **h, ADDRESS * a)
 
   int l, linelen, buflen, count;
 
-  linelen = mutt_strlen (*h);
+  linelen = safe_strlen (*h);
   buflen = linelen + 3;
 
 
@@ -818,7 +818,7 @@ static void format_address_header (char **h, ADDRESS * a)
     rfc822_write_address (buf, sizeof (buf), a, 0);
     a->next = tmp;
 
-    l = mutt_strlen (buf);
+    l = safe_strlen (buf);
     if (count && linelen + l > 74) {
       strcpy (cbuf, "\n\t");    /* __STRCPY_CHECKED__ */
       linelen = l + 8;
@@ -836,7 +836,7 @@ static void format_address_header (char **h, ADDRESS * a)
       strcpy (c2buf, ",");      /* __STRCPY_CHECKED__ */
     }
 
-    buflen += l + mutt_strlen (cbuf) + mutt_strlen (c2buf);
+    buflen += l + safe_strlen (cbuf) + safe_strlen (c2buf);
     safe_realloc (h, buflen);
     strcat (*h, cbuf);          /* __STRCAT_CHECKED__ */
     strcat (*h, buf);           /* __STRCAT_CHECKED__ */
index 4932abd..84bc377 100644 (file)
@@ -148,7 +148,7 @@ static const char *crypt_keyid (crypt_key_t * k)
 
   if (k->kobj && k->kobj->subkeys) {
     s = k->kobj->subkeys->keyid;
-    if ((!option (OPTPGPLONGIDS)) && (mutt_strlen (s) == 16))
+    if ((!option (OPTPGPLONGIDS)) && (safe_strlen (s) == 16))
       /* Return only the short keyID.  */
       s += 8;
   }
@@ -294,11 +294,11 @@ static int crypt_id_matches_addr (ADDRESS * addr, ADDRESS * u_addr,
     rv |= CRYPT_KV_STRONGID;
 
   if (addr->mailbox && u_addr->mailbox
-      && mutt_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
+      && safe_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
     rv |= CRYPT_KV_ADDR;
 
   if (addr->personal && u_addr->personal
-      && mutt_strcasecmp (addr->personal, u_addr->personal) == 0)
+      && safe_strcasecmp (addr->personal, u_addr->personal) == 0)
     rv |= CRYPT_KV_STRING;
 
   return rv;
@@ -1002,7 +1002,7 @@ static int show_sig_summary (unsigned long sum,
       state_attach_puts (": ", s);
       if (t0)
         state_attach_puts (t0, s);
-      if (t1 && !(t0 && !mutt_strcmp (t0, t1))) {
+      if (t1 && !(t0 && !safe_strcmp (t0, t1))) {
         if (t0)
           state_attach_puts (",", s);
         state_attach_puts (t1, s);
@@ -1029,10 +1029,10 @@ static void show_fingerprint (gpgme_key_t key, STATE * state)
     return;
   is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP);
 
-  buf = safe_malloc (mutt_strlen (prefix) + mutt_strlen (s) * 4 + 2);
+  buf = safe_malloc (safe_strlen (prefix) + safe_strlen (s) * 4 + 2);
   strcpy (buf, prefix);         /* __STRCPY_CHECKED__ */
-  p = buf + mutt_strlen (buf);
-  if (is_pgp && mutt_strlen (s) == 40) {     /* PGP v4 style formatted. */
+  p = buf + safe_strlen (buf);
+  if (is_pgp && safe_strlen (s) == 40) {     /* PGP v4 style formatted. */
     for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
       *p++ = s[0];
       *p++ = s[1];
@@ -1297,7 +1297,7 @@ static int verify_one (BODY * sigbdy, STATE * s,
             if (notation->value) {
               state_attach_puts (notation->value, s);
               if (!(*notation->value
-                    && (notation->value[mutt_strlen (notation->value) - 1] ==
+                    && (notation->value[safe_strlen (notation->value) - 1] ==
                         '\n')))
                 state_attach_puts ("\n", s);
             }
@@ -1655,10 +1655,10 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b,
   }
 
   while (fgets (buf, sizeof (buf), tfp)) {
-    if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15)) {
-      if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+    if (!safe_strncmp ("-----BEGIN PGP ", buf, 15)) {
+      if (!safe_strcmp ("MESSAGE-----\n", buf + 15))
         enc = 1;
-      else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
+      else if (!safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
         sgn = 1;
     }
   }
@@ -1737,7 +1737,7 @@ static void copy_clearsigned (gpgme_data_t data, STATE * s, char *charset)
       continue;
     }
 
-    if (!mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n"))
+    if (!safe_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n"))
       break;
 
     if (armor_header) {
@@ -1794,21 +1794,21 @@ void pgp_gpgme_application_handler (BODY * m, STATE * s)
       break;
 
     offset = ftell (s->fpin);
-    bytes -= (offset - last_pos);       /* don't rely on mutt_strlen(buf) */
+    bytes -= (offset - last_pos);       /* don't rely on safe_strlen(buf) */
     last_pos = offset;
 
-    if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15)) {
+    if (!safe_strncmp ("-----BEGIN PGP ", buf, 15)) {
       clearsign = 0;
       start_pos = last_pos;
 
-      if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+      if (!safe_strcmp ("MESSAGE-----\n", buf + 15))
         needpass = 1;
-      else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) {
+      else if (!safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) {
         clearsign = 1;
         needpass = 0;
       }
       else if (!option (OPTDONTHANDLEPGPKEYS) &&
-               !mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) {
+               !safe_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) {
         needpass = 0;
         pgp_keyblock = 1;
       }
@@ -1824,18 +1824,18 @@ void pgp_gpgme_application_handler (BODY * m, STATE * s)
 
       /* Copy PGP material to an data container */
       armored_data = create_gpgme_data ();
-      gpgme_data_write (armored_data, buf, mutt_strlen (buf));
+      gpgme_data_write (armored_data, buf, safe_strlen (buf));
       while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) {
         offset = ftell (s->fpin);
-        bytes -= (offset - last_pos);   /* don't rely on mutt_strlen(buf) */
+        bytes -= (offset - last_pos);   /* don't rely on safe_strlen(buf) */
         last_pos = offset;
 
-        gpgme_data_write (armored_data, buf, mutt_strlen (buf));
+        gpgme_data_write (armored_data, buf, safe_strlen (buf));
 
-        if ((needpass && !mutt_strcmp ("-----END PGP MESSAGE-----\n", buf))
+        if ((needpass && !safe_strcmp ("-----END PGP MESSAGE-----\n", buf))
             || (!needpass
-                && (!mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf)
-                    || !mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
+                && (!safe_strcmp ("-----END PGP SIGNATURE-----\n", buf)
+                    || !safe_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
                                      buf))))
           break;
       }
@@ -2367,10 +2367,10 @@ static int _crypt_compare_address (const void *a, const void *b)
   crypt_key_t **t = (crypt_key_t **) b;
   int r;
 
-  if ((r = mutt_strcasecmp ((*s)->uid, (*t)->uid)))
+  if ((r = safe_strcasecmp ((*s)->uid, (*t)->uid)))
     return r > 0;
   else
-    return mutt_strcasecmp (crypt_keyid (*s), crypt_keyid (*t)) > 0;
+    return safe_strcasecmp (crypt_keyid (*s), crypt_keyid (*t)) > 0;
 }
 
 static int crypt_compare_address (const void *a, const void *b)
@@ -2387,10 +2387,10 @@ static int _crypt_compare_keyid (const void *a, const void *b)
   crypt_key_t **t = (crypt_key_t **) b;
   int r;
 
-  if ((r = mutt_strcasecmp (crypt_keyid (*s), crypt_keyid (*t))))
+  if ((r = safe_strcasecmp (crypt_keyid (*s), crypt_keyid (*t))))
     return r > 0;
   else
-    return mutt_strcasecmp ((*s)->uid, (*t)->uid) > 0;
+    return safe_strcasecmp ((*s)->uid, (*t)->uid) > 0;
 }
 
 static int crypt_compare_keyid (const void *a, const void *b)
@@ -2416,7 +2416,7 @@ static int _crypt_compare_date (const void *a, const void *b)
   if (ts < tt)
     return 0;
 
-  return mutt_strcasecmp ((*s)->uid, (*t)->uid) > 0;
+  return safe_strcasecmp ((*s)->uid, (*t)->uid) > 0;
 }
 
 static int crypt_compare_date (const void *a, const void *b)
@@ -2461,9 +2461,9 @@ static int _crypt_compare_trust (const void *a, const void *b)
   if (ts < tt)
     return 0;
 
-  if ((r = mutt_strcasecmp ((*s)->uid, (*t)->uid)))
+  if ((r = safe_strcasecmp ((*s)->uid, (*t)->uid)))
     return r > 0;
-  return (mutt_strcasecmp (crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
+  return (safe_strcasecmp (crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
 }
 
 static int crypt_compare_trust (const void *a, const void *b)
@@ -2479,10 +2479,10 @@ static int print_dn_part (FILE * fp, struct dn_array_s *dn, const char *key)
   int any = 0;
 
   for (; dn->key; dn++) {
-    if (!mutt_strcmp (dn->key, key)) {
+    if (!safe_strcmp (dn->key, key)) {
       if (any)
         fputs (" + ", fp);
-      print_utf8 (fp, dn->value, mutt_strlen (dn->value));
+      print_utf8 (fp, dn->value, safe_strlen (dn->value));
       any = 1;
     }
   }
@@ -2505,7 +2505,7 @@ static void print_dn_parts (FILE * fp, struct dn_array_s *dn)
   /* now print the rest without any specific ordering */
   for (; dn->key; dn++) {
     for (i = 0; stdpart[i]; i++) {
-      if (!mutt_strcmp (dn->key, stdpart[i]))
+      if (!safe_strcmp (dn->key, stdpart[i]))
         break;
     }
     if (!stdpart[i]) {
@@ -2758,7 +2758,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp)
       putc (' ', fp);
     }
     if (is_pgp)
-      print_utf8 (fp, s, mutt_strlen (s));
+      print_utf8 (fp, s, safe_strlen (s));
     else
       parse_and_print_user_id (fp, s);
     putc ('\n', fp);
@@ -2820,7 +2820,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp)
   if (key->subkeys) {
     s = key->subkeys->fpr;
     fputs (_("Fingerprint: "), fp);
-    if (is_pgp && mutt_strlen (s) == 40) {
+    if (is_pgp && safe_strlen (s) == 40) {
       for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
         putc (*s, fp);
         putc (s[1], fp);
@@ -2866,7 +2866,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp)
       s = subkey->keyid;
 
       putc ('\n', fp);
-      if (mutt_strlen (s) == 16)
+      if (safe_strlen (s) == 16)
         s += 8;                 /* display only the short keyID */
       fprintf (fp, "Subkey ....: 0x%s", s);
       if (subkey->revoked) {
@@ -2979,7 +2979,7 @@ static void verify_key (crypt_key_t * key)
 
   k = key->kobj;
   gpgme_key_ref (k);
-  while ((s = k->chain_id) && k->subkeys && mutt_strcmp (s, k->subkeys->fpr)) {
+  while ((s = k->chain_id) && k->subkeys && safe_strcmp (s, k->subkeys->fpr)) {
     putc ('\n', fp);
     err = gpgme_op_keylist_start (listctx, s, 0);
     gpgme_key_release (k);
@@ -3218,7 +3218,7 @@ static LIST *crypt_add_string_to_hints (LIST * hints, const char *str)
 
   for (t = strtok (scratch, " ,.:\"()<>\n"); t;
        t = strtok (NULL, " ,.:\"()<>\n")) {
-    if (mutt_strlen (t) > 3)
+    if (safe_strlen (t) > 3)
       hints = mutt_add_list (hints, t);
   }
 
@@ -3571,13 +3571,13 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
     dprint (5, (debugfile, "crypt_getkeybystr: matching \"%s\" against "
                 "key %s, \"%s\": ", p, crypt_keyid (k), k->uid));
 
-    if (!*p || !mutt_strcasecmp (p, crypt_keyid (k))
-        || (!mutt_strncasecmp (p, "0x", 2)
-            && !mutt_strcasecmp (p + 2, crypt_keyid (k)))
+    if (!*p || !safe_strcasecmp (p, crypt_keyid (k))
+        || (!safe_strncasecmp (p, "0x", 2)
+            && !safe_strcasecmp (p + 2, crypt_keyid (k)))
         || (option (OPTPGPLONGIDS)
-            && !mutt_strncasecmp (p, "0x", 2)
-            && !mutt_strcasecmp (p + 2, crypt_keyid (k) + 8))
-        || mutt_stristr (k->uid, p)) {
+            && !safe_strncasecmp (p, "0x", 2)
+            && !safe_strcasecmp (p + 2, crypt_keyid (k) + 8))
+        || str_isstr (k->uid, p)) {
       crypt_key_t *tmp;
 
       dprint (5, (debugfile, "match.\n"));
@@ -3623,7 +3623,7 @@ static crypt_key_t *crypt_ask_for_key (char *tag,
   if (whatfor) {
 
     for (l = id_defaults; l; l = l->next)
-      if (!mutt_strcasecmp (whatfor, l->what)) {
+      if (!safe_strcasecmp (whatfor, l->what)) {
         strfcpy (resp, NONULL (l->dflt), sizeof (resp));
         break;
       }
@@ -3637,7 +3637,7 @@ static crypt_key_t *crypt_ask_for_key (char *tag,
 
     if (whatfor) {
       if (l)
-        mutt_str_replace (&l->dflt, resp);
+        str_replace (&l->dflt, resp);
       else {
         l = safe_malloc (sizeof (struct crypt_cache));
         l->next = id_defaults;
@@ -3768,12 +3768,12 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc,
         *r_application &= ~APPLICATION_SMIME;
 #endif
 
-      keylist_size += mutt_strlen (s) + 4 + 1;
+      keylist_size += safe_strlen (s) + 4 + 1;
       safe_realloc (&keylist, keylist_size);
       sprintf (keylist + keylist_used, "%s0x%s%s",      /* __SPRINTF_CHECKED__ */
                keylist_used ? " " : "", s, forced_valid ? "!" : "");
     }
-    keylist_used = mutt_strlen (keylist);
+    keylist_used = safe_strlen (keylist);
 
     crypt_free_key (&key);
     rfc822_free_address (&addr);
@@ -3853,7 +3853,7 @@ static int gpgme_send_menu (HEADER * msg, int *redraw, int is_smime)
                                 is_smime ? APPLICATION_SMIME :
                                 APPLICATION_PGP, NULL))) {
       snprintf (input_signas, sizeof (input_signas), "0x%s", crypt_keyid (p));
-      mutt_str_replace (is_smime ? &SmimeDefaultKey : &PgpSignAs,
+      str_replace (is_smime ? &SmimeDefaultKey : &PgpSignAs,
                         input_signas);
       crypt_free_key (&p);
 
@@ -3923,9 +3923,9 @@ static int verify_sender (HEADER * h, gpgme_protocol_t protocol)
       int sender_length = 0;
       int uid_length = 0;
 
-      sender_length = mutt_strlen (sender->mailbox);
+      sender_length = safe_strlen (sender->mailbox);
       for (uid = key->uids; uid && ret; uid = uid->next) {
-        uid_length = mutt_strlen (uid->email);
+        uid_length = safe_strlen (uid->email);
         if (1 && (uid->email[0] == '<')
             && (uid->email[uid_length - 1] == '>')
             && (uid_length == sender_length + 2)
diff --git a/crypt.c b/crypt.c
index 2b2412e..fbe984a 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -386,7 +386,7 @@ int mutt_is_application_smime (BODY * m)
 
     /* no .p7c, .p10 support yet. */
 
-    len = mutt_strlen (t) - 4;
+    len = safe_strlen (t) - 4;
     if (len > 0 && *(t + len) == '.') {
       len++;
       if (!ascii_strcasecmp ((t + len), "p7m"))
@@ -528,7 +528,7 @@ void convert_to_7bit (BODY * a)
         convert_to_7bit (a->parts);
     }
     else if (a->type == TYPEMESSAGE &&
-             mutt_strcasecmp (a->subtype, "delivery-status")) {
+             safe_strcasecmp (a->subtype, "delivery-status")) {
       if (a->encoding != ENC7BIT)
         mutt_message_to_7bit (a, NULL);
     }
@@ -755,7 +755,7 @@ void mutt_signed_handler (BODY * a, STATE * s)
   /* consistency check */
 
   if (!(a && a->next && a->next->type == protocol_major &&
-        !mutt_strcasecmp (a->next->subtype, protocol_minor))) {
+        !safe_strcasecmp (a->next->subtype, protocol_minor))) {
     state_attach_puts (_("[-- Error: "
                          "Inconsistent multipart/signed structure! --]\n\n"),
                        s);
@@ -766,13 +766,13 @@ void mutt_signed_handler (BODY * a, STATE * s)
 
   if ((WithCrypto & APPLICATION_PGP)
       && protocol_major == TYPEAPPLICATION
-      && !mutt_strcasecmp (protocol_minor, "pgp-signature"));
+      && !safe_strcasecmp (protocol_minor, "pgp-signature"));
   else if ((WithCrypto & APPLICATION_SMIME)
            && protocol_major == TYPEAPPLICATION
-           && !(mutt_strcasecmp (protocol_minor, "x-pkcs7-signature")
-                && mutt_strcasecmp (protocol_minor, "pkcs7-signature")));
+           && !(safe_strcasecmp (protocol_minor, "x-pkcs7-signature")
+                && safe_strcasecmp (protocol_minor, "pkcs7-signature")));
   else if (protocol_major == TYPEMULTIPART
-           && !mutt_strcasecmp (protocol_minor, "mixed"));
+           && !safe_strcasecmp (protocol_minor, "mixed"));
   else {
     state_printf (s, _("[-- Error: "
                        "Unknown multipart/signed protocol %s! --]\n\n"),
@@ -791,7 +791,7 @@ void mutt_signed_handler (BODY * a, STATE * s)
         for (i = 0; i < sigcnt; i++) {
           if ((WithCrypto & APPLICATION_PGP)
               && signatures[i]->type == TYPEAPPLICATION
-              && !mutt_strcasecmp (signatures[i]->subtype, "pgp-signature")) {
+              && !safe_strcasecmp (signatures[i]->subtype, "pgp-signature")) {
             if (crypt_pgp_verify_one (signatures[i], s, tempfile) != 0)
               goodsig = 0;
 
@@ -801,8 +801,8 @@ void mutt_signed_handler (BODY * a, STATE * s)
           if ((WithCrypto & APPLICATION_SMIME)
               && signatures[i]->type == TYPEAPPLICATION
               &&
-              (!mutt_strcasecmp (signatures[i]->subtype, "x-pkcs7-signature")
-               || !mutt_strcasecmp (signatures[i]->subtype,
+              (!safe_strcasecmp (signatures[i]->subtype, "x-pkcs7-signature")
+               || !safe_strcasecmp (signatures[i]->subtype,
                                     "pkcs7-signature"))) {
             if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0)
               goodsig = 0;
index b8b80ad..13c8118 100644 (file)
@@ -143,7 +143,7 @@ int mutt_get_password (char *msg, char *buf, size_t buflen)
   CLEARLINE (LINES - 1);
   addstr (msg);
   set_option (OPTUNBUFFEREDINPUT);
-  rc = mutt_enter_string (buf, buflen, LINES - 1, mutt_strlen (msg), M_PASS);
+  rc = mutt_enter_string (buf, buflen, LINES - 1, safe_strlen (msg), M_PASS);
   unset_option (OPTUNBUFFEREDINPUT);
   CLEARLINE (LINES - 1);
   return (rc);
@@ -217,7 +217,7 @@ int mutt_yesorno (const char *msg, int def)
   answer_string = safe_malloc (COLS + 1);
   snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no,
             def == M_YES ? no : yes);
-  answer_string_len = mutt_strlen (answer_string);
+  answer_string_len = safe_strlen (answer_string);
   printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
   FREE (&answer_string);
 
@@ -403,7 +403,7 @@ int mutt_do_pager (const char *banner,
 {
   int rc;
 
-  if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
+  if (!Pager || safe_strcmp (Pager, "builtin") == 0)
     rc = mutt_pager (banner, tempfile, do_color, info);
   else {
     char cmd[STRING];
@@ -448,7 +448,7 @@ int _mutt_enter_fname (const char *prompt, char *buf, size_t blen,
     *redraw = REDRAW_FULL;
   }
   else {
-    char *pc = safe_malloc (mutt_strlen (prompt) + 3);
+    char *pc = safe_malloc (safe_strlen (prompt) + 3);
 
     sprintf (pc, "%s: ", prompt);       /* __SPRINTF_CHECKED__ */
     mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
@@ -528,7 +528,7 @@ int mutt_multi_choice (char *prompt, char *letters)
       }
       else if (ch.ch <= '9' && ch.ch > '0') {
         choice = ch.ch - '0';
-        if (choice <= mutt_strlen (letters))
+        if (choice <= safe_strlen (letters))
           break;
       }
     }
@@ -648,7 +648,7 @@ static void mutt_format_s_x (char *dest,
   }
 
   mutt_format_string (dest, destlen, min_width, max_width,
-                      right_justify, ' ', s, mutt_strlen (s), arboreal);
+                      right_justify, ' ', s, safe_strlen (s), arboreal);
 }
 
 void mutt_format_s (char *dest,
@@ -673,7 +673,7 @@ void mutt_paddstr (int n, const char *s)
   wchar_t wc;
   int w;
   size_t k;
-  size_t len = mutt_strlen (s);
+  size_t len = safe_strlen (s);
   mbstate_t mbstate;
 
   memset (&mbstate, 0, sizeof (mbstate));
@@ -697,7 +697,7 @@ void mutt_paddstr (int n, const char *s)
 }
 
 /*
- * mutt_strwidth is like mutt_strlen except that it returns the width
+ * mutt_strwidth is like safe_strlen except that it returns the width
  * refering to the number of characters cells.
  */
 
@@ -711,7 +711,7 @@ int mutt_strwidth (const char *s)
   if (!s)
     return 0;
 
-  n = mutt_strlen (s);
+  n = safe_strlen (s);
 
   memset (&mbstate, 0, sizeof (mbstate));
   for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {
index f2b6cb2..1f8e57d 100644 (file)
@@ -1246,18 +1246,18 @@ int mutt_index_menu (void)
         mutt_error (_("%s is not a mailbox."), buf);
         break;
       }
-      mutt_str_replace (&CurrentFolder, buf);
+      str_replace (&CurrentFolder, buf);
 
       if (Context) {
         int check;
 
 #ifdef USE_COMPRESSED
         if (Context->compressinfo && Context->realpath)
-          mutt_str_replace (&LastFolder, Context->realpath);
+          str_replace (&LastFolder, Context->realpath);
         else
 #endif
 
-          mutt_str_replace (&LastFolder, Context->path);
+          str_replace (&LastFolder, Context->path);
         oldcount = Context ? Context->msgcount : 0;
 
         if ((check = mx_close_mailbox (Context, &index_hint)) != 0) {
@@ -2225,7 +2225,7 @@ CHECK_IMAP_ACL(IMAP_ACL_WRITE);
         sleep (2);
       }
       else if (op != OP_FOLLOWUP || !CURHDR->env->followup_to ||
-               mutt_strcasecmp (CURHDR->env->followup_to, "poster") ||
+               safe_strcasecmp (CURHDR->env->followup_to, "poster") ||
                query_quadoption (OPT_FOLLOWUPTOPOSTER,
                                  _("Reply by mail as poster prefers?")) !=
                M_YES) {
index eb761ad..4dea196 100644 (file)
--- a/dotlock.c
+++ b/dotlock.c
@@ -126,7 +126,7 @@ static int dotlock_lock (const char *);
 
 #define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0])
 
-size_t mutt_strlen (const char* s) {
+size_t safe_strlen (const char* s) {
   return (s ? strlen (s) : 0);
 }
 
@@ -453,7 +453,7 @@ static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd)
     dirname = ".";
   }
 
-  if (mutt_strlen (basename) + 1 > l)
+  if (safe_strlen (basename) + 1 > l)
     return -1;
 
   strfcpy (bn, basename, l);
diff --git a/edit.c b/edit.c
index e2a7aa3..b9ffe18 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -63,7 +63,7 @@ static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen,
   tmp[sizeof (tmp) - 1] = 0;
   if (prefix) {
     strfcpy (tmp, NONULL (Prefix), sizeof (tmp));
-    tmplen = mutt_strlen (tmp);
+    tmplen = safe_strlen (tmp);
     p = tmp + tmplen;
     tmplen = sizeof (tmp) - tmplen;
   }
@@ -72,7 +72,7 @@ static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen,
   while (bytes > 0) {
     if (fgets (p, tmplen - 1, f) == NULL)
       break;
-    bytes -= mutt_strlen (p);
+    bytes -= safe_strlen (p);
     if (*bufmax == *buflen)
       safe_realloc (&buf, sizeof (char *) * (*bufmax += 25));
     buf[(*buflen)++] = safe_strdup (tmp);
@@ -245,7 +245,7 @@ static void be_edit_header (ENVELOPE * e, int force)
     addstr ("Subject: ");
     strfcpy (tmp, e->subject ? e->subject : "", sizeof (tmp));
     if (mutt_enter_string (tmp, sizeof (tmp), LINES - 1, 9, 0) == 0)
-      mutt_str_replace (&e->subject, tmp);
+      str_replace (&e->subject, tmp);
     addch ('\n');
   }
 
@@ -316,7 +316,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur)
 
     if (EscChar && tmp[0] == EscChar[0] && tmp[1] != EscChar[0]) {
       /* remove trailing whitespace from the line */
-      p = tmp + mutt_strlen (tmp) - 1;
+      p = tmp + safe_strlen (tmp) - 1;
       while (p >= tmp && ISSPACE (*p))
         *p-- = 0;
 
@@ -345,9 +345,9 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur)
         if (Context) {
           if (!*p && cur) {
             /* include the current message */
-            p = tmp + mutt_strlen (tmp) + 1;
-            snprintf (tmp + mutt_strlen (tmp),
-                      sizeof (tmp) - mutt_strlen (tmp), " %d",
+            p = tmp + safe_strlen (tmp) + 1;
+            snprintf (tmp + safe_strlen (tmp),
+                      sizeof (tmp) - safe_strlen (tmp), " %d",
                       cur->msgno + 1);
           }
           buf = be_include_messages (p, buf, &bufmax, &buflen,
@@ -379,7 +379,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur)
           addstr (_("missing filename.\n"));
         break;
       case 's':
-        mutt_str_replace (&msg->env->subject, p);
+        str_replace (&msg->env->subject, p);
         break;
       case 't':
         msg->env->to = rfc822_parse_adrlist (msg->env->to, p);
@@ -389,7 +389,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur)
         if (buflen) {
           buflen--;
           strfcpy (tmp, buf[buflen], sizeof (tmp));
-          tmp[mutt_strlen (tmp) - 1] = 0;
+          tmp[safe_strlen (tmp) - 1] = 0;
           FREE (&buf[buflen]);
           buf[buflen] = NULL;
           continue;
@@ -433,7 +433,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur)
         break;
       }
     }
-    else if (mutt_strcmp (".", tmp) == 0)
+    else if (safe_strcmp (".", tmp) == 0)
       done = 1;
     else {
       safe_strcat (tmp, sizeof (tmp), "\n");
diff --git a/enter.c b/enter.c
index 793804b..1f5d6c3 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -489,7 +489,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
         }
         else if (flags & M_COMMAND) {
           my_wcstombs (buf, buflen, state->wbuf, state->curpos);
-          i = mutt_strlen (buf);
+          i = safe_strlen (buf);
           if (i && buf[i - 1] == '=' &&
               mutt_var_value_complete (buf, buflen, i))
             state->tabs = 0;
diff --git a/from.c b/from.c
index 33d6e84..23cc264 100644 (file)
--- a/from.c
+++ b/from.c
@@ -33,7 +33,7 @@ int mutt_check_month (const char *s)
   int i;
 
   for (i = 0; i < 12; i++)
-    if (mutt_strncasecmp (s, Months[i], 3) == 0)
+    if (safe_strncasecmp (s, Months[i], 3) == 0)
       return (i);
   return (-1);                  /* error */
 }
@@ -42,10 +42,10 @@ static int is_day_name (const char *s)
 {
   int i;
 
-  if ((mutt_strlen (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
+  if ((safe_strlen (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
     return 0;
   for (i = 0; i < 7; i++)
-    if (mutt_strncasecmp (s, Weekdays[i], 3) == 0)
+    if (safe_strncasecmp (s, Weekdays[i], 3) == 0)
       return 1;
   return 0;
 }
@@ -64,7 +64,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t * tp)
   if (path)
     *path = 0;
 
-  if (mutt_strncmp ("From ", s, 5) != 0)
+  if (safe_strncmp ("From ", s, 5) != 0)
     return 0;
 
   s = next_word (s);            /* skip over the From part. */
index b439c7a..20b270a 100644 (file)
@@ -54,8 +54,8 @@ int getdnsdomainname (char *s, size_t l)
     p = tmp;
     while (ISSPACE (*p))
       p++;
-    if (mutt_strncmp ("domain", p, 6) == 0
-        || mutt_strncmp ("search", p, 6) == 0) {
+    if (safe_strncmp ("domain", p, 6) == 0
+        || safe_strncmp ("search", p, 6) == 0) {
       p += 6;
 
       for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n"))
index 87cbbbd..257220f 100644 (file)
@@ -95,7 +95,7 @@ static void fix_uid (char *uid)
         memcpy (uid, buf, ob - buf);
         uid[ob - buf] = '\0';
       }
-      else if (ob - buf == n && (buf[n] = 0, mutt_strlen (buf) < n))
+      else if (ob - buf == n && (buf[n] = 0, safe_strlen (buf) < n))
         memcpy (uid, buf, n);
     }
     FREE (&buf);
@@ -129,13 +129,13 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
       {
         dprint (2, (debugfile, "record type: %s\n", p));
 
-        if (!mutt_strcmp (p, "pub"));
-        else if (!mutt_strcmp (p, "sub"))
+        if (!safe_strcmp (p, "pub"));
+        else if (!safe_strcmp (p, "sub"))
           *is_subkey = 1;
-        else if (!mutt_strcmp (p, "sec"));
-        else if (!mutt_strcmp (p, "ssb"))
+        else if (!safe_strcmp (p, "sec"));
+        else if (!safe_strcmp (p, "ssb"))
           *is_subkey = 1;
-        else if (!mutt_strcmp (p, "uid"))
+        else if (!safe_strcmp (p, "uid"))
           is_uid = 1;
         else
           return NULL;
@@ -203,7 +203,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
         dprint (2, (debugfile, "key id: %s\n", p));
 
         if (!(*is_subkey && option (OPTPGPIGNORESUB)))
-          mutt_str_replace (&k->keyid, p);
+          str_replace (&k->keyid, p);
         break;
 
       }
@@ -309,7 +309,7 @@ pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints)
   if ((devnull = open ("/dev/null", O_RDWR)) == -1)
     return NULL;
 
-  mutt_str_replace (&_chs, Charset);
+  str_replace (&_chs, Charset);
 
   thepid = pgp_invoke_list_keys (NULL, &fp, NULL, -1, -1, devnull,
                                  keyring, hints);
index b5c3bda..2d355d2 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -241,7 +241,7 @@ void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd)
     if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL)
       break;
 
-    linelen = mutt_strlen (line);
+    linelen = safe_strlen (line);
     len -= linelen;
 
     /*
@@ -369,15 +369,15 @@ void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd)
   while (len > 0) {
     if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
       return;
-    len -= mutt_strlen (tmps);
-    if ((!mutt_strncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
+    len -= safe_strlen (tmps);
+    if ((!safe_strncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
       break;
   }
   while (len > 0) {
     if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
       return;
-    len -= mutt_strlen (tmps);
-    if (!mutt_strncmp (tmps, "end", 3))
+    len -= safe_strlen (tmps);
+    if (!safe_strncmp (tmps, "end", 3))
       break;
     pt = tmps;
     linelen = decode_byte (*pt);
@@ -517,7 +517,7 @@ static void enriched_wrap (struct enriched_state *stte)
   stte->indent_len = 0;
   if (stte->s->prefix) {
     state_puts (stte->s->prefix, stte->s);
-    stte->indent_len += mutt_strlen (stte->s->prefix);
+    stte->indent_len += safe_strlen (stte->s->prefix);
   }
 
   if (stte->tag_level[RICH_EXCERPT]) {
@@ -525,11 +525,11 @@ static void enriched_wrap (struct enriched_state *stte)
     while (x) {
       if (stte->s->prefix) {
         state_puts (stte->s->prefix, stte->s);
-        stte->indent_len += mutt_strlen (stte->s->prefix);
+        stte->indent_len += safe_strlen (stte->s->prefix);
       }
       else {
         state_puts ("> ", stte->s);
-        stte->indent_len += mutt_strlen ("> ");
+        stte->indent_len += safe_strlen ("> ");
       }
       x--;
     }
@@ -631,7 +631,7 @@ static void enriched_puts (char *s, struct enriched_state *stte)
 {
   char *c;
 
-  if (stte->buff_len < stte->buff_used + mutt_strlen (s)) {
+  if (stte->buff_len < stte->buff_used + safe_strlen (s)) {
     stte->buff_len += LONG_STRING;
     safe_realloc (&stte->buffer, stte->buff_len + 1);
   }
@@ -735,7 +735,7 @@ void text_enriched_handler (BODY * a, STATE * s)
 
   if (s->prefix) {
     state_puts (s->prefix, s);
-    stte.indent_len += mutt_strlen (s->prefix);
+    stte.indent_len += safe_strlen (s->prefix);
   }
 
   while (state != DONE) {
@@ -865,13 +865,13 @@ static void flowed_stuff (STATE * s, char *cont, int level)
      * some text on the line which looks like it's quoted, turn off 
      * ANSI colors, so quote coloring doesn't affect this line. 
      */
-    if (*cont && !level && !mutt_strcmp (Pager, "builtin")
+    if (*cont && !level && !safe_strcmp (Pager, "builtin")
         && flowed_maybe_quoted (cont))
       state_puts ("\033[0m", s);
   }
   else if ((!(s->flags & M_PRINTING)) && ((*cont == ' ') || (*cont == '>')
                                           || (!level
-                                              && !mutt_strncmp (cont, "From ",
+                                              && !safe_strncmp (cont, "From ",
                                                                 5))))
     state_putc (' ', s);
 }
@@ -943,7 +943,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
   fprintf (stderr, "flowed_max = %d\n", flowed_max);
 
   while (bytes > 0 && fgets (line, sizeof (line), s->fpin)) {
-    bytes -= mutt_strlen (line);
+    bytes -= safe_strlen (line);
     tail = NULL;
 
     last_full = full;
@@ -973,7 +973,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
        */
 
       full = 0;
-      l = mutt_strlen (t + 1);
+      l = safe_strlen (t + 1);
       t[0] = ' ';
       t[1] = '\0';
 
@@ -1032,7 +1032,7 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
 
     retry_wrap:
       l = flowed_visual_strlen (cont, quoted + i_add + add + col);
-      rl = mutt_strlen (cont);
+      rl = safe_strlen (cont);
       if (quoted + i_add + add + col + l > flowed_max) {
         actually_wrap = 1;
 
@@ -1126,7 +1126,7 @@ static void print_flowed_line (char *line, STATE * s, int ql)
 {
   int width;
   char *pos, *oldpos;
-  int len = mutt_strlen (line);
+  int len = safe_strlen (line);
   int i;
 
   if (MaxLineLength > 0) {
@@ -1150,7 +1150,7 @@ static void print_flowed_line (char *line, STATE * s, int ql)
 
   /* fprintf(stderr,"print_flowed_line will print `%s' with ql = %d\n",line,ql); */
 
-  if (mutt_strlen (line) == 0) {
+  if (safe_strlen (line) == 0) {
     if (option (OPTQUOTEEMPTY)) {
       if (s->prefix)
         state_puts(s->prefix,s);
@@ -1233,24 +1233,24 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
   while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
 
     /* fprintf(stderr,"read `%s'",buf); */
-    bytes -= mutt_strlen (buf);
+    bytes -= safe_strlen (buf);
 
     newql = get_quote_level (buf);
 
     if ((t = strrchr (buf, '\n')) || (t = strrchr (buf, '\r'))) {
       *t = '\0';
-      if (mutt_strlen (curline) > 0 && curline[mutt_strlen (curline) - 1] == ' '
+      if (safe_strlen (curline) > 0 && curline[safe_strlen (curline) - 1] == ' '
           && newql == quotelevel
           && strcmp (curline + quotelevel, "-- ") != 0) {
         if (buf[newql] == ' ')
-          curline[mutt_strlen (curline) - 1] = '\0';
+          curline[safe_strlen (curline) - 1] = '\0';
 
-        curline = realloc (curline, curline_len + mutt_strlen (buf));
+        curline = realloc (curline, curline_len + safe_strlen (buf));
         if (curline_len == 1)
           *curline = '\0';
-        curline_len += mutt_strlen (buf);
+        curline_len += safe_strlen (buf);
         safe_strncat (curline, curline_len, buf + newql,
-                      mutt_strlen (buf + newql));
+                      safe_strlen (buf + newql));
       }
       else {
         if (first_line) {
@@ -1261,11 +1261,11 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
         }
         FREE (&curline);
         curline_len = 1;
-        curline = realloc (curline, curline_len + mutt_strlen (buf));
+        curline = realloc (curline, curline_len + safe_strlen (buf));
         if (curline_len == 1)
           *curline = '\0';
-        curline_len += mutt_strlen (buf);
-        safe_strncat (curline, curline_len, buf, mutt_strlen (buf));
+        curline_len += safe_strlen (buf);
+        safe_strncat (curline, curline_len, buf, safe_strlen (buf));
         quotelevel = newql;
       }
     }
@@ -1329,7 +1329,7 @@ static void alternative_handler (BODY * a, STATE * s)
     }
     else {
       wild = 1;
-      btlen = mutt_strlen (t->data);
+      btlen = safe_strlen (t->data);
     }
 
     if (a && a->parts)
@@ -1878,7 +1878,7 @@ void mutt_body_handler (BODY * b, STATE * s)
         handler = mutt_signed_handler;
     }
     else if ((WithCrypto & APPLICATION_PGP)
-             && mutt_strcasecmp ("encrypted", b->subtype) == 0) {
+             && safe_strcasecmp ("encrypted", b->subtype) == 0) {
       p = mutt_get_parameter ("protocol", b->parameter);
 
       if (!p)
diff --git a/hash.c b/hash.c
index 77fc7e8..63775bb 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -97,7 +97,7 @@ int hash_insert (HASH * table, const char *key, void *data, int allow_dup)
     int r;
 
     for (tmp = table->table[h], last = NULL; tmp; last = tmp, tmp = tmp->next) {
-      r = mutt_strcmp (tmp->key, key);
+      r = safe_strcmp (tmp->key, key);
       if (r == 0) {
         FREE (&ptr);
         return (-1);
@@ -120,7 +120,7 @@ void *hash_find_hash (const HASH * table, int hash, const char *key)
   struct hash_elem *ptr = table->table[hash];
 
   for (; ptr; ptr = ptr->next) {
-    if (mutt_strcmp (key, ptr->key) == 0)
+    if (safe_strcmp (key, ptr->key) == 0)
       return (ptr->data);
   }
   return NULL;
@@ -137,7 +137,7 @@ void hash_delete_hash (HASH * table, int hash, const char *key,
      * required for the case where we have multiple entries with the same
      * key
      */
-    if ((data == ptr->data) || (!data && mutt_strcmp (ptr->key, key) == 0)) {
+    if ((data == ptr->data) || (!data && safe_strcmp (ptr->key, key) == 0)) {
       *last = ptr->next;
       if (destroy)
         destroy (ptr->data);
index 2b052f3..5e26743 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -113,7 +113,7 @@ static unsigned char *dump_char (char *c, unsigned char *d, int *off)
     return d;
   }
 
-  size = mutt_strlen (c) + 1;
+  size = safe_strlen (c) + 1;
   d = dump_int (size, d, off);
   lazy_realloc (&d, *off + size);
   memcpy (d + *off, c, size);
@@ -427,36 +427,36 @@ static int generate_crc32 ()
 
   crc = crc32 (crc, (unsigned char const *)
                "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613",
-               mutt_strlen
+               safe_strlen
                ("sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613"));
 
 #if HAVE_LANGINFO_CODESET
-  crc = crc32 (crc, (unsigned char const *) Charset, mutt_strlen (Charset));
+  crc = crc32 (crc, (unsigned char const *) Charset, safe_strlen (Charset));
   crc =
     crc32 (crc, (unsigned char const *) "HAVE_LANGINFO_CODESET",
-           mutt_strlen ("HAVE_LANGINFO_CODESET"));
+           safe_strlen ("HAVE_LANGINFO_CODESET"));
 #endif
 
 #if EXACT_ADDRESS
   crc =
     crc32 (crc, (unsigned char const *) "EXACT_ADDRESS",
-           mutt_strlen ("EXACT_ADDRESS"));
+           safe_strlen ("EXACT_ADDRESS"));
 #endif
 
 #ifdef USE_POP
   crc =
-    crc32 (crc, (unsigned char const *) "USE_POP", mutt_strlen ("USE_POP"));
+    crc32 (crc, (unsigned char const *) "USE_POP", safe_strlen ("USE_POP"));
 #endif
 
 #ifdef MIXMASTER
   crc =
     crc32 (crc, (unsigned char const *) "MIXMASTER",
-           mutt_strlen ("MIXMASTER"));
+           safe_strlen ("MIXMASTER"));
 #endif
 
 #ifdef USE_IMAP
   crc =
-    crc32 (crc, (unsigned char const *) "USE_IMAP", mutt_strlen ("USE_IMAP"));
+    crc32 (crc, (unsigned char const *) "USE_IMAP", safe_strlen ("USE_IMAP"));
 #endif
   return crc;
 }
@@ -495,7 +495,7 @@ static const char *mutt_hcache_per_folder (const char *path,
   }
 
   MD5Init (&md5);
-  MD5Update (&md5, (unsigned char *) folder, mutt_strlen (folder));
+  MD5Update (&md5, (unsigned char *) folder, safe_strlen (folder));
   MD5Final (md5sum, &md5);
 
   ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
@@ -644,7 +644,7 @@ void *mutt_hcache_fetch (void *db, const char *filename,
   }
 
   strncpy (path, h->folder, sizeof (path));
-  strncat (path, filename, sizeof (path) - mutt_strlen (path));
+  strncat (path, filename, sizeof (path) - safe_strlen (path));
 
   key.dptr = path;
   key.dsize = keylen (path);
@@ -674,7 +674,7 @@ mutt_hcache_store (void *db, const char *filename, HEADER * header,
   }
 
   strncpy (path, h->folder, sizeof (path));
-  strncat (path, filename, sizeof (path) - mutt_strlen (path));
+  strncat (path, filename, sizeof (path) - safe_strlen (path));
 
   key.dptr = path;
   key.dsize = keylen (path);
@@ -701,7 +701,7 @@ mutt_hcache_delete (void *db, const char *filename,
   }
 
   strncpy (path, h->folder, sizeof (path));
-  strncat (path, filename, sizeof (path) - mutt_strlen (path));
+  strncat (path, filename, sizeof (path) - safe_strlen (path));
 
   key.dptr = path;
   key.dsize = keylen (path);
index 2ac88f1..7d023d9 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -587,7 +587,7 @@ static const char *hdr_format_str (char *dest,
     snprintf (dest, destlen, fmt,
               (Tochars
                && ((i = mutt_user_is_recipient (hdr))) <
-               mutt_strlen (Tochars)) ? Tochars[i] : ' ');
+               safe_strlen (Tochars)) ? Tochars[i] : ' ');
     break;
 
   case 'u':
@@ -659,7 +659,7 @@ static const char *hdr_format_str (char *dest,
                                                     ((i =
                                                       mutt_user_is_recipient
                                                       (hdr)) <
-                                                     mutt_strlen (Tochars)) ?
+                                                     safe_strlen (Tochars)) ?
                                                     Tochars[i] : ' ')));
     mutt_format_s (dest, destlen, prefix, buf2);
     break;
@@ -683,7 +683,7 @@ static const char *hdr_format_str (char *dest,
                && (hdr->thread->parent && hdr->thread->parent->message
                    && hdr->thread->parent->message->env->x_label))
         htmp = hdr->thread->parent->message;
-      if (htmp && mutt_strcasecmp (hdr->env->x_label,
+      if (htmp && safe_strcasecmp (hdr->env->x_label,
                                    htmp->env->x_label) == 0)
         i = 0;
     }
index 371ca55..6134788 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -143,7 +143,7 @@ void mutt_edit_headers (const char *editor,
       SKIPWS (p);
       if (*p) {
         if ((q = strpbrk (p, " \t"))) {
-          mutt_substrcpy (path, p, q, sizeof (path));
+          str_substrcpy (path, p, q, sizeof (path));
           SKIPWS (q);
         }
         else
diff --git a/help.c b/help.c
index 0cc3b74..d061743 100644 (file)
--- a/help.c
+++ b/help.c
@@ -71,7 +71,7 @@ char *mutt_compile_help (char *buf, size_t buflen, int menu,
       buflen -= 2;
     }
     mutt_make_help (pbuf, buflen, _(items[i].name), menu, items[i].value);
-    len = mutt_strlen (pbuf);
+    len = safe_strlen (pbuf);
     pbuf += len;
     buflen -= len;
   }
@@ -84,7 +84,7 @@ static int print_macro (FILE * f, int maxwidth, const char **macro)
   wchar_t wc;
   int w;
   size_t k;
-  size_t len = mutt_strlen (*macro);
+  size_t len = safe_strlen (*macro);
   mbstate_t mbstate1, mbstate2;
 
   memset (&mbstate1, 0, sizeof (mbstate1));
@@ -167,18 +167,18 @@ static void format_line (FILE * f, int ismacro,
   else {
     col_a = COLS > 83 ? (COLS - 32) >> 2 : 12;
     col_b = COLS > 49 ? (COLS - 10) >> 1 : 19;
-    col = pad (f, mutt_strlen (t1), col_a);
+    col = pad (f, safe_strlen (t1), col_a);
   }
 
   if (ismacro > 0) {
-    if (!mutt_strcmp (Pager, "builtin"))
+    if (!safe_strcmp (Pager, "builtin"))
       fputs ("_\010", f);
     fputs ("M ", f);
     col += 2;
 
     if (!split) {
       col += print_macro (f, col_b - col - 4, &t2);
-      if (mutt_strlen (t2) > col_b - col)
+      if (safe_strlen (t2) > col_b - col)
         t2 = "...";
     }
   }
@@ -201,7 +201,7 @@ static void format_line (FILE * f, int ismacro,
         SKIPWS (t3);
 
         /* FIXME: this is completely wrong */
-        if ((n = mutt_strlen (t3)) > COLS - col) {
+        if ((n = safe_strlen (t3)) > COLS - col) {
           n = COLS - col;
           for (col_a = n; col_a > 0 && t3[col_a] != ' '; col_a--);
           if (col_a)
@@ -212,7 +212,7 @@ static void format_line (FILE * f, int ismacro,
       print_macro (f, n, &t3);
 
       if (*t3) {
-        if (mutt_strcmp (Pager, "builtin")) {
+        if (safe_strcmp (Pager, "builtin")) {
           fputc ('\n', f);
           n = 0;
         }
index 27c345b..bfbe60f 100644 (file)
--- a/history.c
+++ b/history.c
@@ -70,8 +70,8 @@ void mutt_history_add (history_class_t hclass, const char *s)
     prev = h->last - 1;
     if (prev < 0)
       prev = HistSize - 1;
-    if (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0) {
-      mutt_str_replace (&h->hist[h->last++], s);
+    if (!h->hist[prev] || safe_strcmp (h->hist[prev], s) != 0) {
+      str_replace (&h->hist[h->last++], s);
       if (h->last > HistSize - 1)
         h->last = 0;
     }
diff --git a/hook.c b/hook.c
index 68a662e..19b2e68 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -121,14 +121,14 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data,
   /* check to make sure that a matching hook doesn't already exist */
   for (ptr = Hooks; ptr; ptr = ptr->next) {
     if (ptr->type == data &&
-        ptr->rx.not == not && !mutt_strcmp (pattern.data, ptr->rx.pattern)) {
+        ptr->rx.not == not && !safe_strcmp (pattern.data, ptr->rx.pattern)) {
       if (data &
           (M_FOLDERHOOK | M_SENDHOOK | M_SEND2HOOK | M_MESSAGEHOOK |
            M_ACCOUNTHOOK | M_REPLYHOOK)) {
         /* these hooks allow multiple commands with the same
          * pattern, so if we've already seen this pattern/command pair, just
          * ignore it instead of creating a duplicate */
-        if (!mutt_strcmp (ptr->command, command.data)) {
+        if (!safe_strcmp (ptr->command, command.data)) {
           FREE (&command.data);
           FREE (&pattern.data);
           return 0;
@@ -240,7 +240,7 @@ int mutt_parse_unhook (BUFFER * buf, BUFFER * s, unsigned long data,
 {
   while (MoreArgs (s)) {
     mutt_extract_token (buf, s, 0);
-    if (mutt_strcmp ("*", buf->data) == 0) {
+    if (safe_strcmp ("*", buf->data) == 0) {
       if (current_hook_type) {
         snprintf (err->data, err->dsize,
                   _("unhook: Can't do unhook * from within a hook."));
index 41e20e1..3843ca3 100644 (file)
@@ -100,7 +100,7 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA * idata, const char *method)
    */
 
   mutt_to_base64 ((unsigned char *) ibuf, (unsigned char *) obuf,
-                  mutt_strlen (obuf), sizeof (ibuf) - 2);
+                  safe_strlen (obuf), sizeof (ibuf) - 2);
   safe_strcat (ibuf, sizeof (ibuf), "\r\n");
   mutt_socket_write (idata->conn, ibuf);
 
@@ -133,8 +133,8 @@ static void hmac_md5 (const char *password, char *challenge,
   unsigned int secret_len, chal_len;
   int i;
 
-  secret_len = mutt_strlen (password);
-  chal_len = mutt_strlen (challenge);
+  secret_len = safe_strlen (password);
+  chal_len = safe_strlen (challenge);
 
   /* passwords longer than MD5_BLOCK_LEN bytes are substituted with their MD5
    * digests */
index 61bef81..4602c47 100644 (file)
@@ -59,7 +59,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method)
   /* get an IMAP service ticket for the server */
   snprintf (buf1, sizeof (buf1), "imap@%s", idata->conn->account.host);
   request_buf.value = buf1;
-  request_buf.length = mutt_strlen (buf1) + 1;
+  request_buf.length = safe_strlen (buf1) + 1;
   maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name,
                               &target_name);
   if (maj_stat != GSS_S_COMPLETE) {
@@ -201,7 +201,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method)
   /* server decides if principal can log in as user */
   strncpy (buf1 + 4, idata->conn->account.user, sizeof (buf1) - 4);
   request_buf.value = buf1;
-  request_buf.length = 4 + mutt_strlen (idata->conn->account.user) + 1;
+  request_buf.length = 4 + safe_strlen (idata->conn->account.user) + 1;
   maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
                        &cflags, &send_token);
   if (maj_stat != GSS_S_COMPLETE) {
index 67452b9..e83544f 100644 (file)
@@ -131,10 +131,10 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method)
     if (irc == IMAP_CMD_RESPOND) {
 #ifdef USE_SASL2
       if (sasl_decode64
-          (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf,
+          (idata->cmd.buf + 2, safe_strlen (idata->cmd.buf + 2), buf,
            LONG_STRING - 1,
 #else
-      if (sasl_decode64 (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf,
+      if (sasl_decode64 (idata->cmd.buf + 2, safe_strlen (idata->cmd.buf + 2), buf,
 #endif
                          &len) != SASL_OK) {
         dprint (1,
index 1a92a69..dbccc6a 100644 (file)
@@ -97,7 +97,7 @@ int imap_browse (char *path, struct browser_state *state)
     imap_unquote_string (buf);  /* As kludgy as it gets */
     mbox[sizeof (mbox) - 1] = '\0';
     strncpy (mbox, buf, sizeof (mbox) - 1);
-    n = mutt_strlen (mbox);
+    n = safe_strlen (mbox);
 
     dprint (3, (debugfile, "imap_browse: mbox: %s\n", mbox));
 
@@ -115,7 +115,7 @@ int imap_browse (char *path, struct browser_state *state)
           imap_unmunge_mbox_name (cur_folder);
 
           if (!noinferiors && cur_folder[0] &&
-              (n = mutt_strlen (mbox)) < LONG_STRING - 1) {
+              (n = safe_strlen (mbox)) < LONG_STRING - 1) {
             mbox[n++] = idata->delim;
             mbox[n] = '\0';
           }
@@ -257,7 +257,7 @@ int imap_mailbox_create (const char *folder)
   strfcpy (buf, NONULL (mx.mbox), sizeof (buf));
 
   /* append a delimiter if necessary */
-  n = mutt_strlen (buf);
+  n = safe_strlen (buf);
   if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
     buf[n++] = idata->delim;
     buf[n] = '\0';
@@ -266,7 +266,7 @@ int imap_mailbox_create (const char *folder)
   if (mutt_get_field (_("Create mailbox: "), buf, sizeof (buf), M_FILE) < 0)
     goto fail;
 
-  if (!mutt_strlen (buf)) {
+  if (!safe_strlen (buf)) {
     mutt_error (_("Mailbox must have a name."));
     mutt_sleep (1);
     goto fail;
@@ -313,7 +313,7 @@ int imap_mailbox_rename (const char *mailbox)
   if (mutt_get_field (buf, newname, sizeof (newname), M_FILE) < 0)
     goto fail;
 
-  if (!mutt_strlen (newname)) {
+  if (!safe_strlen (newname)) {
     mutt_error (_("Mailbox must have a name."));
     mutt_sleep (1);
     goto fail;
@@ -366,7 +366,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd,
       if (isparent)
         noselect = 1;
       /* prune current folder from output */
-      if (isparent || mutt_strncmp (name, mx.mbox, mutt_strlen (name)))
+      if (isparent || safe_strncmp (name, mx.mbox, safe_strlen (name)))
         imap_add_folder (idata->delim, name, noselect, noinferiors, state,
                          isparent);
     }
@@ -404,8 +404,8 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   if (isparent)
     strfcpy (relpath, "../", sizeof (relpath));
   /* strip current folder from target, to render a relative path */
-  else if (!mutt_strncmp (mx.mbox, folder, mutt_strlen (mx.mbox)))
-    strfcpy (relpath, folder + mutt_strlen (mx.mbox), sizeof (relpath));
+  else if (!safe_strncmp (mx.mbox, folder, safe_strlen (mx.mbox)))
+    strfcpy (relpath, folder + safe_strlen (mx.mbox), sizeof (relpath));
   else
     strfcpy (relpath, folder, sizeof (relpath));
 
@@ -421,9 +421,9 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   (state->entry)[state->entrylen].name = safe_strdup (tmp);
 
   /* mark desc with delim in browser if it can have subfolders */
-  if (!isparent && !noinferiors && mutt_strlen (relpath) < sizeof (relpath) - 1) {
-    relpath[mutt_strlen (relpath) + 1] = '\0';
-    relpath[mutt_strlen (relpath)] = delim;
+  if (!isparent && !noinferiors && safe_strlen (relpath) < sizeof (relpath) - 1) {
+    relpath[safe_strlen (relpath) + 1] = '\0';
+    relpath[safe_strlen (relpath)] = delim;
   }
 
   (state->entry)[state->entrylen].desc = safe_strdup (relpath);
@@ -442,7 +442,7 @@ static void imap_add_folder (char delim, char *folder, int noselect,
 
 static int compare_names (struct folder_file *a, struct folder_file *b)
 {
-  return mutt_strcmp (a->name, b->name);
+  return safe_strcmp (a->name, b->name);
 }
 
 static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen,
index 69d0d69..8451386 100644 (file)
@@ -69,7 +69,7 @@ int imap_cmd_start (IMAP_DATA * idata, const char *cmd)
 
   cmd_make_sequence (idata);
   /* seq, space, cmd, \r\n\0 */
-  outlen = mutt_strlen (idata->cmd.seq) + mutt_strlen (cmd) + 4;
+  outlen = safe_strlen (idata->cmd.seq) + safe_strlen (cmd) + 4;
   out = (char *) safe_malloc (outlen);
   snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
 
@@ -179,7 +179,7 @@ int imap_exec (IMAP_DATA * idata, const char *cmd, int flags)
   /* create sequence for command */
   cmd_make_sequence (idata);
   /* seq, space, cmd, \r\n\0 */
-  outlen = mutt_strlen (idata->cmd.seq) + mutt_strlen (cmd) + 4;
+  outlen = safe_strlen (idata->cmd.seq) + safe_strlen (cmd) + 4;
   out = (char *) safe_malloc (outlen);
   snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
 
index 5cce86d..6ada64f 100644 (file)
@@ -1177,9 +1177,9 @@ int imap_mailbox_check (char *path, int new)
    * command on a mailbox that you have selected 
    */
 
-  if (mutt_strcmp (mbox_unquoted, idata->mailbox) == 0
+  if (safe_strcmp (mbox_unquoted, idata->mailbox) == 0
       || (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0
-          && mutt_strcasecmp (mbox_unquoted, idata->mailbox) == 0)) {
+          && safe_strcasecmp (mbox_unquoted, idata->mailbox) == 0)) {
     strfcpy (buf, "NOOP", sizeof (buf));
   }
   else if (mutt_bit_isset (idata->capabilities, IMAP4REV1) ||
@@ -1204,8 +1204,8 @@ int imap_mailbox_check (char *path, int new)
       /* The mailbox name may or may not be quoted here. We could try to 
        * munge the server response and compare with quoted (or vise versa)
        * but it is probably more efficient to just strncmp against both. */
-      if (mutt_strncmp (mbox_unquoted, s, mutt_strlen (mbox_unquoted)) == 0
-          || mutt_strncmp (mbox, s, mutt_strlen (mbox)) == 0) {
+      if (safe_strncmp (mbox_unquoted, s, safe_strlen (mbox_unquoted)) == 0
+          || safe_strncmp (mbox, s, safe_strlen (mbox)) == 0) {
         s = imap_next_word (s);
         s = imap_next_word (s);
         if (isdigit ((unsigned char) *s)) {
@@ -1396,14 +1396,14 @@ int imap_complete (char *dest, size_t dlen, char *path)
       /* if the folder isn't selectable, append delimiter to force browse
        * to enter it on second tab. */
       if (noselect) {
-        clen = mutt_strlen (list_word);
+        clen = safe_strlen (list_word);
         list_word[clen++] = delim;
         list_word[clen] = '\0';
       }
       /* copy in first word */
       if (!completions) {
         strfcpy (completion, list_word, sizeof (completion));
-        matchlen = mutt_strlen (completion);
+        matchlen = safe_strlen (completion);
         completions++;
         continue;
       }
index e7f8ce5..08a9d3f 100644 (file)
@@ -882,7 +882,7 @@ static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf,
 #if USE_HCACHE
 static size_t imap_hcache_keylen (const char *fn)
 {
-  return mutt_strlen (fn);
+  return safe_strlen (fn);
 }
 
 /* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER.
@@ -938,7 +938,7 @@ static int msg_has_flag (LIST * flag_list, const char *flag)
 
   flag_list = flag_list->next;
   while (flag_list) {
-    if (!ascii_strncasecmp (flag_list->data, flag, mutt_strlen (flag_list->data)))
+    if (!ascii_strncasecmp (flag_list->data, flag, safe_strlen (flag_list->data)))
       return 1;
 
     flag_list = flag_list->next;
index bc5571a..3fa10c7 100644 (file)
@@ -235,7 +235,7 @@ void imap_utf7_encode (char **s)
     char *t = safe_strdup (*s);
 
     if (!mutt_convert_string (&t, Charset, "UTF-8", 0))
-      utf8_to_utf7 (t, mutt_strlen (t), s, 0);
+      utf8_to_utf7 (t, safe_strlen (t), s, 0);
     FREE (&t);
   }
 }
@@ -243,7 +243,7 @@ void imap_utf7_encode (char **s)
 void imap_utf7_decode (char **s)
 {
   if (Charset) {
-    char *t = utf7_to_utf8 (*s, mutt_strlen (*s), 0, 0);
+    char *t = utf7_to_utf8 (*s, safe_strlen (*s), 0, 0);
 
     if (t && !mutt_convert_string (&t, "UTF-8", Charset, 0)) {
       FREE (s);
index 9a632a5..e6c101c 100644 (file)
@@ -178,12 +178,12 @@ void imap_pretty_mailbox (char *path)
   if (imap_parse_path (path, &target) < 0)
     return;
 
-  tlen = mutt_strlen (target.mbox);
+  tlen = safe_strlen (target.mbox);
   /* check whether we can do '=' substitution */
   if (mx_is_imap (Maildir) && !imap_parse_path (Maildir, &home)) {
-    hlen = mutt_strlen (home.mbox);
+    hlen = safe_strlen (home.mbox);
     if (tlen && mutt_account_match (&home.account, &target.account) &&
-        !mutt_strncmp (home.mbox, target.mbox, hlen)) {
+        !safe_strncmp (home.mbox, target.mbox, hlen)) {
       if (!hlen)
         home_match = 1;
       else
@@ -489,7 +489,7 @@ void imap_unmunge_mbox_name (char *s)
   buf = safe_strdup (s);
   if (buf) {
     imap_utf7_decode (&buf);
-    strncpy (s, buf, mutt_strlen (s));
+    strncpy (s, buf, safe_strlen (s));
   }
 
   FREE (&buf);
diff --git a/init.c b/init.c
index 0d3f3b1..3573ff9 100644 (file)
--- a/init.c
+++ b/init.c
@@ -92,7 +92,7 @@ int mutt_option_index (char *s)
   int i;
 
   for (i = 0; MuttVars[i].option; i++)
-    if (mutt_strcmp (s, MuttVars[i].option) == 0)
+    if (safe_strcmp (s, MuttVars[i].option) == 0)
       return (MuttVars[i].type ==
               DT_SYN ? mutt_option_index ((char *) MuttVars[i].data) : i);
   return (-1);
@@ -200,7 +200,7 @@ int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
         dprint (1, (debugfile, "mutt_get_token: mismatched backtics\n"));
         return (-1);
       }
-      cmd = mutt_substrdup (tok->dptr, pc);
+      cmd = str_substrdup (tok->dptr, pc);
       if ((pid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) {
         dprint (1,
                 (debugfile, "mutt_get_token: unable to fork command: %s",
@@ -227,8 +227,8 @@ int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
         FREE (&expn.data);
       }
       else if (expn.data) {
-        expnlen = mutt_strlen (expn.data);
-        tok->dsize = expnlen + mutt_strlen (tok->dptr) + 1;
+        expnlen = safe_strlen (expn.data);
+        tok->dsize = expnlen + safe_strlen (tok->dptr) + 1;
         ptr = safe_malloc (tok->dsize);
         memcpy (ptr, expn.data, expnlen);
         strcpy (ptr + expnlen, tok->dptr);      /* __STRCPY_CHECKED__ */
@@ -248,14 +248,14 @@ int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
       if (*tok->dptr == '{') {
         tok->dptr++;
         if ((pc = strchr (tok->dptr, '}'))) {
-          var = mutt_substrdup (tok->dptr, pc);
+          var = str_substrdup (tok->dptr, pc);
           tok->dptr = pc + 1;
         }
       }
       else {
         for (pc = tok->dptr; isalpha ((unsigned char) *pc) || *pc == '_';
              pc++);
-        var = mutt_substrdup (tok->dptr, pc);
+        var = str_substrdup (tok->dptr, pc);
         tok->dptr = pc;
       }
       if (var && (env = getenv (var)))
@@ -396,7 +396,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat)
 
   /* Being first is a special case. */
   spam = *list;
-  if (spam->rx && !mutt_strcmp (spam->rx->pattern, pat)) {
+  if (spam->rx && !safe_strcmp (spam->rx->pattern, pat)) {
     *list = spam->next;
     rx_free (&spam->rx);
     FREE(&spam->template);
@@ -406,7 +406,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat)
 
   prev = spam;
   for (spam = prev->next; spam;) {
-    if (!mutt_strcmp (spam->rx->pattern, pat)) {
+    if (!safe_strcmp (spam->rx->pattern, pat)) {
       prev->next = spam->next;
       rx_free (&spam->rx);
       FREE(spam->template);
@@ -426,7 +426,7 @@ static void remove_from_list (LIST ** l, const char *str)
 {
   LIST *p, *last = NULL;
 
-  if (mutt_strcmp ("*", str) == 0)
+  if (safe_strcmp ("*", str) == 0)
     mutt_free_list (l);         /* ``unCMD *'' means delete all current entries */
   else {
     p = *l;
@@ -452,7 +452,7 @@ static int remove_from_rx_list (list2_t** l, const char *str)
 {
   int i = 0;
 
-  if (mutt_strcmp ("*", str) == 0) {
+  if (safe_strcmp ("*", str) == 0) {
     list_del (l, rx_free);
     return (0);
   }
@@ -485,8 +485,8 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data,
         continue;
 
       for (j = 0; b[j].name; j++)
-        if (!ascii_strncasecmp (tmp->data, b[j].name, mutt_strlen (tmp->data))
-            && (mutt_strlen (b[j].name) == mutt_strlen (tmp->data))) {
+        if (!ascii_strncasecmp (tmp->data, b[j].name, safe_strlen (tmp->data))
+            && (safe_strlen (b[j].name) == safe_strlen (tmp->data))) {
           res = 1;
           break;
         }
@@ -496,13 +496,13 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data,
     char *p = NULL;
 
     i = 0;
-    j = mutt_strlen (tmp->data);
+    j = safe_strlen (tmp->data);
     /* need at least input of 'feature_X' */
     if (j >= 7) {
       p = tmp->data + 7;
       j -= 7;
       while (Features[i].name) {
-        if (mutt_strlen (Features[i].name) == j &&
+        if (safe_strlen (Features[i].name) == j &&
             ascii_strncasecmp (Features[i].name, p, j)) {
           res = 1;
           break;
@@ -608,7 +608,7 @@ static int parse_unalternates (BUFFER * buf, BUFFER * s, unsigned long data,
     mutt_extract_token (buf, s, 0);
     remove_from_rx_list (&Alternates, buf->data);
 
-    if (mutt_strcmp (buf->data, "*") &&
+    if (safe_strcmp (buf->data, "*") &&
         add_to_rx_list (&UnAlternates, buf->data, REG_ICASE, err) != 0)
       return -1;
 
@@ -664,7 +664,7 @@ static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data,
     /* nospam only ever has one parameter. */
 
     /* "*" is a special case. */
-    if (!mutt_strcmp (buf->data, "*")) {
+    if (!safe_strcmp (buf->data, "*")) {
       mutt_free_spam_list (&SpamList);
       list_del (&NoSpamList, rx_free);
       return 0;
@@ -694,7 +694,7 @@ static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data,
     /*
      * Check for deletion of entire list
      */
-    if (mutt_strcmp (buf->data, "*") == 0) {
+    if (safe_strcmp (buf->data, "*") == 0) {
       mutt_free_list ((LIST **) data);
       break;
     }
@@ -728,7 +728,7 @@ static int parse_unlists (BUFFER * buf, BUFFER * s, unsigned long data,
     remove_from_rx_list (&SubscribedLists, buf->data);
     remove_from_rx_list (&MailLists, buf->data);
 
-    if (mutt_strcmp (buf->data, "*") &&
+    if (safe_strcmp (buf->data, "*") &&
         add_to_rx_list (&UnMailLists, buf->data, REG_ICASE, err) != 0)
       return -1;
   }
@@ -762,7 +762,7 @@ static int parse_unsubscribe (BUFFER * buf, BUFFER * s, unsigned long data,
     mutt_extract_token (buf, s, 0);
     remove_from_rx_list (&SubscribedLists, buf->data);
 
-    if (mutt_strcmp (buf->data, "*") &&
+    if (safe_strcmp (buf->data, "*") &&
         add_to_rx_list (&UnSubscribedLists, buf->data, REG_ICASE, err) != 0)
       return -1;
   }
@@ -779,7 +779,7 @@ static int parse_unalias (BUFFER * buf, BUFFER * s, unsigned long data,
   do {
     mutt_extract_token (buf, s, 0);
 
-    if (mutt_strcmp ("*", buf->data) == 0) {
+    if (safe_strcmp ("*", buf->data) == 0) {
       if (CurrentMenu == MENU_ALIAS) {
         for (tmp = Aliases; tmp; tmp = tmp->next)
           tmp->del = 1;
@@ -791,7 +791,7 @@ static int parse_unalias (BUFFER * buf, BUFFER * s, unsigned long data,
     }
     else
       for (tmp = Aliases; tmp; tmp = tmp->next) {
-        if (mutt_strcasecmp (buf->data, tmp->name) == 0) {
+        if (safe_strcasecmp (buf->data, tmp->name) == 0) {
           if (CurrentMenu == MENU_ALIAS) {
             tmp->del = 1;
             set_option (OPTFORCEREDRAWINDEX);
@@ -831,7 +831,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s, unsigned long data,
 
   /* check to see if an alias with this name already exists */
   for (; tmp; tmp = tmp->next) {
-    if (!mutt_strcasecmp (tmp->name, buf->data))
+    if (!safe_strcasecmp (tmp->name, buf->data))
       break;
     last = tmp;
   }
@@ -890,13 +890,13 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s, unsigned long data, BUFFER * err)
 
   do {
     mutt_extract_token (buf, s, 0);
-    if (mutt_strcmp ("*", buf->data) == 0)
+    if (safe_strcmp ("*", buf->data) == 0)
       mutt_free_list (&UserHeader);
     else {
       tmp = UserHeader;
       last = NULL;
 
-      l = mutt_strlen (buf->data);
+      l = safe_strlen (buf->data);
       if (buf->data[l - 1] == ':')
         l--;
 
@@ -968,12 +968,12 @@ parse_sort (short *val, const char *s, const struct mapping_t *map,
 {
   int i, flags = 0;
 
-  if (mutt_strncmp ("reverse-", s, 8) == 0) {
+  if (safe_strncmp ("reverse-", s, 8) == 0) {
     s += 8;
     flags = SORT_REVERSE;
   }
 
-  if (mutt_strncmp ("last-", s, 5) == 0) {
+  if (safe_strncmp ("last-", s, 5) == 0) {
     s += 5;
     flags |= SORT_LAST;
   }
@@ -1028,7 +1028,7 @@ static void mutt_restore_default (struct option_t *p)
   switch (p->type & DT_MASK) {
   case DT_STR:
     if (p->init)
-      mutt_str_replace ((char **) p->data, (char *) p->init);
+      str_replace ((char **) p->data, (char *) p->init);
     break;
   case DT_PATH:
     if (p->init) {
@@ -1036,7 +1036,7 @@ static void mutt_restore_default (struct option_t *p)
 
       strfcpy (path, (char *) p->init, sizeof (path));
       mutt_expand_path (path, sizeof (path));
-      mutt_str_replace ((char **) p->data, path);
+      str_replace ((char **) p->data, path);
     }
     break;
   case DT_ADDR:
@@ -1074,9 +1074,9 @@ static void mutt_restore_default (struct option_t *p)
         char *s = (char *) p->init;
 
         pp->rx = safe_calloc (1, sizeof (regex_t));
-        if (mutt_strcmp (p->option, "mask") != 0)
+        if (safe_strcmp (p->option, "mask") != 0)
           flags |= mutt_which_case ((const char *) p->init);
-        if (mutt_strcmp (p->option, "mask") == 0 && *s == '!') {
+        if (safe_strcmp (p->option, "mask") == 0 && *s == '!') {
           s++;
           pp->not = 1;
         }
@@ -1089,7 +1089,7 @@ static void mutt_restore_default (struct option_t *p)
           FREE (&pp->rx);
         }
         else
-          mutt_str_replace (&pp->pattern, (char *) p->init);
+          str_replace (&pp->pattern, (char *) p->init);
       }
     }
     break;
@@ -1126,11 +1126,11 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
       query = 1;
       s->dptr++;
     }
-    else if (mutt_strncmp ("no", s->dptr, 2) == 0) {
+    else if (safe_strncmp ("no", s->dptr, 2) == 0) {
       s->dptr += 2;
       unset = !unset;
     }
-    else if (mutt_strncmp ("inv", s->dptr, 3) == 0) {
+    else if (safe_strncmp ("inv", s->dptr, 3) == 0) {
       s->dptr += 3;
       inv = !inv;
     }
@@ -1143,7 +1143,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
     mutt_extract_token (tmp, s, M_TOKEN_EQUAL);
 
     if ((idx = mutt_option_index (tmp->data)) == -1 &&
-        !(reset && !mutt_strcmp ("all", tmp->data))) {
+        !(reset && !safe_strcmp ("all", tmp->data))) {
       snprintf (err->data, err->dsize, _("%s: unknown variable"), tmp->data);
       return (-1);
     }
@@ -1160,7 +1160,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
         return (-1);
       }
 
-      if (!mutt_strcmp ("all", tmp->data)) {
+      if (!safe_strcmp ("all", tmp->data)) {
         for (idx = 0; MuttVars[idx].option; idx++)
           mutt_restore_default (&MuttVars[idx]);
         return 0;
@@ -1244,7 +1244,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
         }
         else if (DTYPE (MuttVars[idx].type) == DT_STR) {
           *((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
-          if (mutt_strcmp (MuttVars[idx].option, "charset") == 0)
+          if (safe_strcmp (MuttVars[idx].option, "charset") == 0)
             mutt_set_charset (Charset);
         }
         else {
@@ -1266,7 +1266,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
       }
 
       if (option (OPTATTACHMSG)
-          && !mutt_strcmp (MuttVars[idx].option, "reply_regexp")) {
+          && !safe_strcmp (MuttVars[idx].option, "reply_regexp")) {
         snprintf (err->data, err->dsize,
                   "Operation not permitted when in attach-message mode.");
         r = -1;
@@ -1278,15 +1278,15 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
       /* copy the value of the string */
       mutt_extract_token (tmp, s, 0);
 
-      if (!ptr->pattern || mutt_strcmp (ptr->pattern, tmp->data) != 0) {
+      if (!ptr->pattern || safe_strcmp (ptr->pattern, tmp->data) != 0) {
         int not = 0;
 
         /* $mask is case-sensitive */
-        if (mutt_strcmp (MuttVars[idx].option, "mask") != 0)
+        if (safe_strcmp (MuttVars[idx].option, "mask") != 0)
           flags |= mutt_which_case (tmp->data);
 
         p = tmp->data;
-        if (mutt_strcmp (MuttVars[idx].option, "mask") == 0) {
+        if (safe_strcmp (MuttVars[idx].option, "mask") == 0) {
           if (*p == '!') {
             not = 1;
             p++;
@@ -1315,7 +1315,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
         /* $reply_regexp and $alterantes require special treatment */
 
         if (Context && Context->msgcount &&
-            mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0) {
+            safe_strcmp (MuttVars[idx].option, "reply_regexp") == 0) {
           regmatch_t pmatch[1];
           int i;
 
@@ -1391,12 +1391,12 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
         *ptr = (short) val;
 
       /* these ones need a sanity check */
-      if (mutt_strcmp (MuttVars[idx].option, "history") == 0) {
+      if (safe_strcmp (MuttVars[idx].option, "history") == 0) {
         if (*ptr < 0)
           *ptr = 0;
         mutt_init_history ();
       }
-      else if (mutt_strcmp (MuttVars[idx].option, "pager_index_lines") == 0) {
+      else if (safe_strcmp (MuttVars[idx].option, "pager_index_lines") == 0) {
         if (*ptr < 0)
           *ptr = 0;
       }
@@ -1614,7 +1614,7 @@ int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err)
 
   memset (&expn, 0, sizeof (expn));
   expn.data = expn.dptr = line;
-  expn.dsize = mutt_strlen (line);
+  expn.dsize = safe_strlen (line);
 
   *err->data = 0;
 
@@ -1628,7 +1628,7 @@ int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err)
     }
     mutt_extract_token (token, &expn, 0);
     for (i = 0; Commands[i].name; i++) {
-      if (!mutt_strcmp (token->data, Commands[i].name)) {
+      if (!safe_strcmp (token->data, Commands[i].name)) {
         if (Commands[i].func (token, &expn, Commands[i].data, err) != 0)
           goto finish;
         break;
@@ -1726,18 +1726,18 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
     /* return the completed command */
     strncpy (buffer, Completed, len - spaces);
   }
-  else if (!mutt_strncmp (buffer, "set", 3)
-           || !mutt_strncmp (buffer, "unset", 5)
-           || !mutt_strncmp (buffer, "reset", 5)
-           || !mutt_strncmp (buffer, "toggle", 6)) {    /* complete variables */
+  else if (!safe_strncmp (buffer, "set", 3)
+           || !safe_strncmp (buffer, "unset", 5)
+           || !safe_strncmp (buffer, "reset", 5)
+           || !safe_strncmp (buffer, "toggle", 6)) {    /* complete variables */
     char *prefixes[] = { "no", "inv", "?", "&", 0 };
 
     pt++;
     /* loop through all the possible prefixes (no, inv, ...) */
-    if (!mutt_strncmp (buffer, "set", 3)) {
+    if (!safe_strncmp (buffer, "set", 3)) {
       for (num = 0; prefixes[num]; num++) {
-        if (!mutt_strncmp (pt, prefixes[num], mutt_strlen (prefixes[num]))) {
-          pt += mutt_strlen (prefixes[num]);
+        if (!safe_strncmp (pt, prefixes[num], safe_strlen (prefixes[num]))) {
+          pt += safe_strlen (prefixes[num]);
           break;
         }
       }
@@ -1774,7 +1774,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
 
     strncpy (pt, Completed, buffer + len - pt - spaces);
   }
-  else if (!mutt_strncmp (buffer, "exec", 4)) {
+  else if (!safe_strncmp (buffer, "exec", 4)) {
     struct binding_t *menu = km_get_table (CurrentMenu);
 
     if (!menu && CurrentMenu != MENU_PAGER)
@@ -1842,12 +1842,12 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
   if (*pt == '=')               /* abort if no var before the '=' */
     return 0;
 
-  if (mutt_strncmp (buffer, "set", 3) == 0) {
+  if (safe_strncmp (buffer, "set", 3) == 0) {
     int idx;
 
     strfcpy (var, pt, sizeof (var));
     /* ignore the trailing '=' when comparing */
-    var[mutt_strlen (var) - 1] = 0;
+    var[safe_strlen (var) - 1] = 0;
     if ((idx = mutt_option_index (var)) == -1)
       return 0;                 /* no such variable. */
     else {
@@ -2080,7 +2080,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, '.'))) {
-    Hostname = mutt_substrdup (utsname.nodename, p);
+    Hostname = str_substrdup (utsname.nodename, p);
     p++;
     strfcpy (buffer, p, sizeof (buffer));       /* save the domain for below */
   }
@@ -2094,7 +2094,7 @@ void mutt_init (int skip_sys_rc, LIST * commands)
   else
 #endif /* DOMAIN */
   if (*DOMAIN != '@') {
-    Fqdn = safe_malloc (mutt_strlen (DOMAIN) + mutt_strlen (Hostname) + 2);
+    Fqdn = safe_malloc (safe_strlen (DOMAIN) + safe_strlen (Hostname) + 2);
     sprintf (Fqdn, "%s.%s", NONULL (Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */
   }
   else
@@ -2163,7 +2163,7 @@ void mutt_init (int skip_sys_rc, LIST * commands)
 
     memset (&buf, 0, sizeof (buf));
     buf.data = buf.dptr = buffer;
-    buf.dsize = mutt_strlen (buffer);
+    buf.dsize = safe_strlen (buffer);
 
     memset (&token, 0, sizeof (token));
     parse_my_hdr (&token, &buf, 0, &err);
index 6f71eda..3944aab 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -247,7 +247,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) &&
-        mutt_strlen (bindings[i].name) == len)
+        safe_strlen (bindings[i].name) == len)
       return bindings[i].op;
   }
 
@@ -269,7 +269,7 @@ static char *get_func (struct binding_t *bindings, int op)
 
 static void push_string (char *s)
 {
-  char *pp, *p = s + mutt_strlen (s) - 1;
+  char *pp, *p = s + safe_strlen (s) - 1;
   size_t l;
   int i, op = OP_NULL;
 
@@ -488,7 +488,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 = mutt_strlen (s));
+    len -= (l = safe_strlen (s));
 
     if (++p >= map->len || !len)
       return (1);
@@ -717,7 +717,7 @@ try_bind (char *key, int menu, char *func, struct binding_t *bindings)
   int i;
 
   for (i = 0; bindings[i].name; i++)
-    if (mutt_strcmp (func, bindings[i].name) == 0) {
+    if (safe_strcmp (func, bindings[i].name) == 0) {
       km_bindkey (key, menu, bindings[i].op);
       return (0);
     }
@@ -880,9 +880,9 @@ int mutt_parse_exec (BUFFER * buf, BUFFER * s, unsigned long data,
         && CurrentMenu != MENU_PAGER)
       bindings = OpGeneric;
 
-    ops[nops] = get_op (bindings, function, mutt_strlen (function));
+    ops[nops] = get_op (bindings, function, safe_strlen (function));
     if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
-      ops[nops] = get_op (OpGeneric, function, mutt_strlen (function));
+      ops[nops] = get_op (OpGeneric, function, safe_strlen (function));
 
     if (ops[nops] == OP_NULL) {
       mutt_flushinp ();
diff --git a/lib.c b/lib.c
index c5adcc3..b57070b 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -154,7 +154,7 @@ int safe_symlink (const char *oldpath, const char *newpath)
     char abs_oldpath[_POSIX_PATH_MAX];
 
     if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) ||
-        (mutt_strlen (abs_oldpath) + 1 + mutt_strlen (oldpath) + 1 >
+        (safe_strlen (abs_oldpath) + 1 + safe_strlen (oldpath) + 1 >
          sizeof abs_oldpath))
       return -1;
 
@@ -415,7 +415,7 @@ char *mutt_concat_path (char *d, const char *dir, const char *fname, size_t l)
 {
   const char *fmt = "%s/%s";
 
-  if (!*fname || (*dir && dir[mutt_strlen (dir) - 1] == '/'))
+  if (!*fname || (*dir && dir[safe_strlen (dir) - 1] == '/'))
     fmt = "%s%s";
 
   snprintf (d, l, fmt, dir, fname);
diff --git a/lib.h b/lib.h
index e07a410..b12b8cc 100644 (file)
--- a/lib.h
+++ b/lib.h
@@ -52,7 +52,6 @@ char *mutt_concat_path (char *, const char *, const char *, size_t);
 char *mutt_read_line (char *, size_t *, FILE *, int *);
 char *mutt_skip_whitespace (char *);
 
-const char *mutt_stristr (const char *, const char *);
 const char *mutt_basename (const char *);
 
 int mutt_copy_stream (FILE *, FILE *);
@@ -65,7 +64,6 @@ int safe_rename (const char *, const char *);
 int safe_fclose (FILE **);
 
 size_t mutt_quote_filename (char *, size_t, const char *);
-size_t mutt_strlen (const char *);
 
 void mutt_nocurses_error (const char *, ...);
 void mutt_remove_trailing_ws (char *);
index 168a3fe..0158f16 100644 (file)
--- a/lib/rx.c
+++ b/lib/rx.c
@@ -32,7 +32,7 @@ void rx_free (rx_t** p) {
 }
 
 int rx_compare (const rx_t* r1, const rx_t* r2) {
-  return (mutt_strcmp (r1->pattern, r2->pattern));
+  return (safe_strcmp (r1->pattern, r2->pattern));
 }
 
 int rx_list_match (list2_t* l, const char* pat) {
@@ -50,7 +50,7 @@ int rx_lookup (list2_t* l, const char* pat) {
   if (!pat || !*pat || list_empty(l))
     return (-1);
   for (i = 0; i < l->length; i++)
-    if (mutt_strcmp (((rx_t*) l->data[i])->pattern, pat) == 0)
+    if (safe_strcmp (((rx_t*) l->data[i])->pattern, pat) == 0)
       return (i);
   return (-1);
 }
index 79bb469..8efa126 100644 (file)
--- a/lib/str.c
+++ b/lib/str.c
@@ -23,7 +23,7 @@ char *safe_strdup (const char *s)
 
   if (!s || !*s)
     return 0;
-  l = mutt_strlen (s) + 1;
+  l = safe_strlen (s) + 1;
   p = (char *) safe_malloc (l);
   memcpy (p, s, l);
   return (p);
@@ -67,21 +67,51 @@ char *safe_strncat (char *d, size_t l, const char *s, size_t sl)
   return p;
 }
 
-void mutt_str_replace (char **p, const char *s)
+int safe_strcmp (const char *a, const char *b)
+{
+  return strcmp (NONULL (a), NONULL (b));
+}
+
+int safe_strcasecmp (const char *a, const char *b)
+{
+  return strcasecmp (NONULL (a), NONULL (b));
+}
+
+int safe_strncmp (const char *a, const char *b, size_t l)
+{
+  return strncmp (NONULL (a), NONULL (b), l);
+}
+
+int safe_strncasecmp (const char *a, const char *b, size_t l)
+{
+  return strncasecmp (NONULL (a), NONULL (b), l);
+}
+
+size_t safe_strlen (const char *a)
+{
+  return a ? strlen (a) : 0;
+}
+
+int safe_strcoll (const char *a, const char *b)
+{
+  return strcoll (NONULL (a), NONULL (b));
+}
+
+void str_replace (char **p, const char *s)
 {
   FREE (p);
   *p = safe_strdup (s);
 }
 
-void mutt_str_adjust (char **p)
+void str_adjust (char **p)
 {
   if (!p || !*p)
     return;
-  safe_realloc (p, mutt_strlen (*p) + 1);
+  safe_realloc (p, safe_strlen (*p) + 1);
 }
 
 /* convert all characters in the string to lowercase */
-char *mutt_strlower (char *s)
+char *str_tolower (char *s)
 {
   char *p = s;
 
@@ -95,7 +125,7 @@ char *mutt_strlower (char *s)
 
 /* NULL-pointer aware string comparison functions */
 
-char *mutt_substrcpy (char *dest, const char *beg, const char *end,
+char *str_substrcpy (char *dest, const char *beg, const char *end,
                       size_t destlen)
 {
   size_t len;
@@ -108,7 +138,7 @@ char *mutt_substrcpy (char *dest, const char *beg, const char *end,
   return dest;
 }
 
-char *mutt_substrdup (const char *begin, const char *end)
+char *str_substrdup (const char *begin, const char *end)
 {
   size_t len;
   char *p;
@@ -116,7 +146,7 @@ char *mutt_substrdup (const char *begin, const char *end)
   if (end)
     len = end - begin;
   else
-    len = mutt_strlen (begin);
+    len = safe_strlen (begin);
 
   p = safe_malloc (len + 1);
   memcpy (p, begin, len);
@@ -124,37 +154,7 @@ char *mutt_substrdup (const char *begin, const char *end)
   return p;
 }
 
-int mutt_strcmp (const char *a, const char *b)
-{
-  return strcmp (NONULL (a), NONULL (b));
-}
-
-int mutt_strcasecmp (const char *a, const char *b)
-{
-  return strcasecmp (NONULL (a), NONULL (b));
-}
-
-int mutt_strncmp (const char *a, const char *b, size_t l)
-{
-  return strncmp (NONULL (a), NONULL (b), l);
-}
-
-int mutt_strncasecmp (const char *a, const char *b, size_t l)
-{
-  return strncasecmp (NONULL (a), NONULL (b), l);
-}
-
-size_t mutt_strlen (const char *a)
-{
-  return a ? strlen (a) : 0;
-}
-
-int mutt_strcoll (const char *a, const char *b)
-{
-  return strcoll (NONULL (a), NONULL (b));
-}
-
-const char *mutt_stristr (const char *haystack, const char *needle)
+const char *str_isstr (const char *haystack, const char *needle)
 {
   const char *p, *q;
 
@@ -185,7 +185,6 @@ void mutt_remove_trailing_ws (char *s)
 {
   char *p;
 
-  for (p = s + mutt_strlen (s) - 1; p >= s && ISSPACE (*p); p--)
+  for (p = s + safe_strlen (s) - 1; p >= s && ISSPACE (*p); p--)
     *p = 0;
 }
-
index cc2e3ac..3dc825e 100644 (file)
--- a/lib/str.h
+++ b/lib/str.h
@@ -15,7 +15,7 @@
 
 #define NONULL(x) x?x:""
 
-# define HUGE_STRING   5120
+# define HUGE_STRING     5120
 # define LONG_STRING     1024
 # define STRING          256
 # define SHORT_STRING    128
 # define MUTT_FORMAT2(a,b)     _MUTT_FORMAT_1(a, b)
 
 # define ISSPACE(c) isspace((unsigned char)c)
+# define ISBLANK(c) (c == ' ' || c == '\t')
 # define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0
-
-/* this macro must check for *c == 0 since isspace(0) has unreliable behavior
-   on some systems */
+/* this macro must check for *c == 0 since isspace(0) has
+ * unreliable behavior on some systems */
 # define SKIPWS(c) while (*(c) && isspace ((unsigned char) *(c))) c++;
 
-#define ISBLANK(c) (c == ' ' || c == '\t')
 /*
- * These functions aren't defined in lib.c, but
- * they are used there.
- *
- * A non-mutt "implementation" (ahem) can be found in extlib.c.
+ * safety wrappers/replacements
+ * (mostly only difference: safely handle NULL strings)
  */
+char *safe_strdup (const char*);
+char *safe_strcat (char*, size_t, const char*);
+char *safe_strncat (char*, size_t, const char*, size_t);
+int safe_strcmp (const char*, const char*);
+int safe_strcasecmp (const char*, const char*);
+int safe_strncmp (const char*, const char*, size_t);
+int safe_strncasecmp (const char*, const char*, size_t);
+int safe_strcoll (const char*, const char*);
+size_t safe_strlen (const char*);
 
-char *mutt_strlower (char *);
-char *mutt_substrcpy (char *, const char *, const char *, size_t);
-char *mutt_substrdup (const char *, const char *);
-char *safe_strcat (char *, size_t, const char *);
-char *safe_strncat (char *, size_t, const char *, size_t);
-char *safe_strdup (const char *);
-int mutt_strcasecmp (const char *, const char *);
-int mutt_strcmp (const char *, const char *);
-int mutt_strncasecmp (const char *, const char *, size_t);
-int mutt_strncmp (const char *, const char *, size_t);
-int mutt_strcoll (const char *, const char *);
-void mutt_str_replace (char **p, const char *s);
-void mutt_str_adjust (char **p);
-size_t mutt_strlen (const char *a);
+/*
+ * tools
+ */
+char *str_tolower (char*);
+char *str_substrcpy (char*, const char*, const char*, size_t);
+char *str_substrdup (const char*, const char*);
+void str_replace (char**, const char*);
+void str_adjust (char**);
+const char *str_isstr (const char*, const char*);
 
 #endif /* !_LIB_STR_H */
diff --git a/main.c b/main.c
index 95c3ddf..1ee36df 100644 (file)
--- a/main.c
+++ b/main.c
@@ -568,7 +568,7 @@ int main (int argc, char **argv)
       break;
 
     case 'F':
-      mutt_str_replace (&Muttrc, optarg);
+      str_replace (&Muttrc, optarg);
       break;
 
     case 'f':
@@ -804,7 +804,7 @@ int main (int argc, char **argv)
 
     if (infile || bodytext) {
       if (infile) {
-        if (mutt_strcmp ("-", infile) == 0)
+        if (safe_strcmp ("-", infile) == 0)
           fin = stdin;
         else {
           char path[_POSIX_PATH_MAX];
@@ -928,8 +928,8 @@ int main (int argc, char **argv)
 #endif
       mutt_expand_path (folder, sizeof (folder));
 
-    mutt_str_replace (&CurrentFolder, folder);
-    mutt_str_replace (&LastFolder, folder);
+    str_replace (&CurrentFolder, folder);
+    str_replace (&LastFolder, folder);
 
     if (flags & M_IGNORE) {
       /* check to see if there are any messages in the folder */
diff --git a/mbox.c b/mbox.c
index 63a8633..e973d3b 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -114,7 +114,7 @@ int mmdf_parse_mailbox (CONTEXT * ctx)
     if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL)
       break;
 
-    if (mutt_strcmp (buf, MMDF_SEP) == 0) {
+    if (safe_strcmp (buf, MMDF_SEP) == 0) {
       loc = ftell (ctx->fp);
 
       count++;
@@ -158,7 +158,7 @@ int mmdf_parse_mailbox (CONTEXT * ctx)
         if (0 < tmploc && tmploc < ctx->size) {
           if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL ||
-              mutt_strcmp (MMDF_SEP, buf) != 0) {
+              safe_strcmp (MMDF_SEP, buf) != 0) {
             if (fseek (ctx->fp, loc, SEEK_SET) != 0)
               dprint (1, (debugfile, "mmdf_parse_mailbox: fseek() failed\n"));
             hdr->content->length = -1;
@@ -177,7 +177,7 @@ int mmdf_parse_mailbox (CONTEXT * ctx)
           if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL)
             break;
           lines++;
-        } while (mutt_strcmp (buf, MMDF_SEP) != 0);
+        } while (safe_strcmp (buf, MMDF_SEP) != 0);
 
         hdr->lines = lines;
         hdr->content->length = loc - hdr->content->offset;
@@ -298,7 +298,7 @@ int mbox_parse_mailbox (CONTEXT * ctx)
            */
           if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf), ctx->fp) == NULL ||
-              mutt_strncmp ("From ", buf, 5) != 0) {
+              safe_strncmp ("From ", buf, 5) != 0) {
             dprint (1,
                     (debugfile,
                      "mbox_parse_mailbox: bad content-length in message %d (cl=%ld)\n",
@@ -411,8 +411,8 @@ int mbox_open_mailbox (CONTEXT * ctx)
 static int strict_addrcmp (const ADDRESS * a, const ADDRESS * b)
 {
   while (a && b) {
-    if (mutt_strcmp (a->mailbox, b->mailbox) ||
-        mutt_strcmp (a->personal, b->personal))
+    if (safe_strcmp (a->mailbox, b->mailbox) ||
+        safe_strcmp (a->personal, b->personal))
       return (0);
 
     a = a->next;
@@ -427,7 +427,7 @@ static int strict_addrcmp (const ADDRESS * a, const ADDRESS * b)
 static int strict_cmp_lists (const LIST * a, const LIST * b)
 {
   while (a && b) {
-    if (mutt_strcmp (a->data, b->data))
+    if (safe_strcmp (a->data, b->data))
       return (0);
 
     a = a->next;
@@ -442,8 +442,8 @@ static int strict_cmp_lists (const LIST * a, const LIST * b)
 static int strict_cmp_envelopes (const ENVELOPE * e1, const ENVELOPE * e2)
 {
   if (e1 && e2) {
-    if (mutt_strcmp (e1->message_id, e2->message_id) ||
-        mutt_strcmp (e1->subject, e2->subject) ||
+    if (safe_strcmp (e1->message_id, e2->message_id) ||
+        safe_strcmp (e1->subject, e2->subject) ||
         !strict_cmp_lists (e1->references, e2->references) ||
         !strict_addrcmp (e1->from, e2->from) ||
         !strict_addrcmp (e1->sender, e2->sender) ||
@@ -466,8 +466,8 @@ static int strict_cmp_envelopes (const ENVELOPE * e1, const ENVELOPE * e2)
 static int strict_cmp_parameters (const PARAMETER * p1, const PARAMETER * p2)
 {
   while (p1 && p2) {
-    if (mutt_strcmp (p1->attribute, p2->attribute) ||
-        mutt_strcmp (p1->value, p2->value))
+    if (safe_strcmp (p1->attribute, p2->attribute) ||
+        safe_strcmp (p1->value, p2->value))
       return (0);
 
     p1 = p1->next;
@@ -483,8 +483,8 @@ static int strict_cmp_bodies (const BODY * b1, const BODY * b2)
 {
   if (b1->type != b2->type ||
       b1->encoding != b2->encoding ||
-      mutt_strcmp (b1->subtype, b2->subtype) ||
-      mutt_strcmp (b1->description, b2->description) ||
+      safe_strcmp (b1->subtype, b2->subtype) ||
+      safe_strcmp (b1->description, b2->description) ||
       !strict_cmp_parameters (b1->parameter, b2->parameter) ||
       b1->length != b2->length)
     return (0);
@@ -567,8 +567,8 @@ int mbox_check_mailbox (CONTEXT * ctx, int *index_hint)
       if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0)
         dprint (1, (debugfile, "mbox_check_mailbox: fseek() failed\n"));
       if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL) {
-        if ((ctx->magic == M_MBOX && mutt_strncmp ("From ", buffer, 5) == 0)
-            || (ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buffer) == 0)) {
+        if ((ctx->magic == M_MBOX && safe_strncmp ("From ", buffer, 5) == 0)
+            || (ctx->magic == M_MMDF && safe_strcmp (MMDF_SEP, buffer) == 0)) {
           if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0)
             dprint (1, (debugfile, "mbox_check_mailbox: fseek() failed\n"));
           if (ctx->magic == M_MBOX)
@@ -832,8 +832,8 @@ int mbox_sync_mailbox (CONTEXT * ctx, int *index_hint)
   if (fseek (ctx->fp, offset, SEEK_SET) != 0 || /* seek the append location */
       /* do a sanity check to make sure the mailbox looks ok */
       fgets (buf, sizeof (buf), ctx->fp) == NULL ||
-      (ctx->magic == M_MBOX && mutt_strncmp ("From ", buf, 5) != 0) ||
-      (ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buf) != 0)) {
+      (ctx->magic == M_MBOX && safe_strncmp ("From ", buf, 5) != 0) ||
+      (ctx->magic == M_MMDF && safe_strcmp (MMDF_SEP, buf) != 0)) {
     dprint (1,
             (debugfile,
              "mbox_sync_mailbox: message not in expected position."));
diff --git a/menu.c b/menu.c
index 1406e17..e86c4f0 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -36,7 +36,7 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color)
 {
   wchar_t wc;
   size_t k;
-  size_t n = mutt_strlen ((char *) s);
+  size_t n = safe_strlen ((char *) s);
   mbstate_t mbstate;
 
   memset (&mbstate, 0, sizeof (mbstate));
@@ -155,7 +155,7 @@ void menu_pad_string (char *s, size_t n)
     cols = COLS - shift - SidebarWidth;
   else
     cols = COLS - shift;
-  mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, mutt_strlen (s), 1);
+  mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, safe_strlen (s), 1);
   tmpbuf[n - 1] = 0;
   snprintf (s, n, "%s", tmpbuf);        /* overkill */
   FREE (&tmpbuf);
@@ -697,7 +697,7 @@ static int menu_search (MUTTMENU * menu, int op)
                         _("Reverse search for: "),
                         buf, sizeof (buf), M_CLEAR) != 0 || !buf[0])
       return (-1);
-    mutt_str_replace (&menu->searchBuf, buf);
+    str_replace (&menu->searchBuf, buf);
     menu->searchDir = (op == OP_SEARCH) ? M_SEARCH_DOWN : M_SEARCH_UP;
   }
   else {
diff --git a/mh.c b/mh.c
index 7028dbf..e695a93 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -150,11 +150,11 @@ static void mh_read_sequences (struct mh_sequences *mhs, const char *path)
     if (!(t = strtok (buff, " \t:")))
       continue;
 
-    if (!mutt_strcmp (t, MhUnseen))
+    if (!safe_strcmp (t, MhUnseen))
       f = MH_SEQ_UNSEEN;
-    else if (!mutt_strcmp (t, MhFlagged))
+    else if (!safe_strcmp (t, MhFlagged))
       f = MH_SEQ_FLAGGED;
-    else if (!mutt_strcmp (t, MhReplied))
+    else if (!safe_strcmp (t, MhReplied))
       f = MH_SEQ_REPLIED;
     else                        /* unknown sequence */
       continue;
@@ -297,11 +297,11 @@ void mh_update_sequences (CONTEXT * ctx)
   /* first, copy unknown sequences */
   if ((ofp = fopen (sequences, "r"))) {
     while ((buff = mutt_read_line (buff, &s, ofp, &l))) {
-      if (!mutt_strncmp (buff, seq_unseen, mutt_strlen (seq_unseen)))
+      if (!safe_strncmp (buff, seq_unseen, safe_strlen (seq_unseen)))
         continue;
-      if (!mutt_strncmp (buff, seq_flagged, mutt_strlen (seq_flagged)))
+      if (!safe_strncmp (buff, seq_flagged, safe_strlen (seq_flagged)))
         continue;
-      if (!mutt_strncmp (buff, seq_replied, mutt_strlen (seq_replied)))
+      if (!safe_strncmp (buff, seq_replied, safe_strlen (seq_replied)))
         continue;
 
       fprintf (nfp, "%s\n", buff);
@@ -388,17 +388,17 @@ static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen,
   snprintf (sequences, sizeof (sequences), "%s/.mh_sequences", ctx->path);
   if ((ofp = fopen (sequences, "r"))) {
     while ((buff = mutt_read_line (buff, &sz, ofp, &line))) {
-      if (unseen && !strncmp (buff, seq_unseen, mutt_strlen (seq_unseen))) {
+      if (unseen && !strncmp (buff, seq_unseen, safe_strlen (seq_unseen))) {
         fprintf (nfp, "%s %d\n", buff, n);
         unseen_done = 1;
       }
       else if (flagged
-               && !strncmp (buff, seq_flagged, mutt_strlen (seq_flagged))) {
+               && !strncmp (buff, seq_flagged, safe_strlen (seq_flagged))) {
         fprintf (nfp, "%s %d\n", buff, n);
         flagged_done = 1;
       }
       else if (replied
-               && !strncmp (buff, seq_replied, mutt_strlen (seq_replied))) {
+               && !strncmp (buff, seq_replied, safe_strlen (seq_replied))) {
         fprintf (nfp, "%s %d\n", buff, n);
         replied_done = 1;
       }
@@ -481,10 +481,10 @@ static void maildir_parse_flags (HEADER * h, const char *path)
   h->read = 0;
   h->replied = 0;
 
-  if ((p = strrchr (path, ':')) != NULL && mutt_strncmp (p + 1, "2,", 2) == 0) {
+  if ((p = strrchr (path, ':')) != NULL && safe_strncmp (p + 1, "2,", 2) == 0) {
     p += 3;
 
-    mutt_str_replace (&h->maildir_flags, p);
+    str_replace (&h->maildir_flags, p);
     q = h->maildir_flags;
 
     while (*p) {
@@ -676,7 +676,7 @@ static int maildir_parse_dir (CONTEXT * ctx, struct maildir ***last,
 
   if (subdir) {
     snprintf (buf, sizeof (buf), "%s/%s", ctx->path, subdir);
-    is_old = (mutt_strcmp ("cur", subdir) == 0);
+    is_old = (safe_strcmp ("cur", subdir) == 0);
   }
   else
     strfcpy (buf, ctx->path, sizeof (buf));
@@ -834,7 +834,7 @@ static size_t maildir_hcache_keylen (const char *fn)
 {
   const char *p = strchr (fn, ':');
 
-  return p ? (size_t) (p - fn) : mutt_strlen (fn);
+  return p ? (size_t) (p - fn) : safe_strlen (fn);
 }
 #endif
 
@@ -996,7 +996,7 @@ static void maildir_flags (char *dest, size_t destlen, HEADER * hdr)
               hdr->read ? "S" : "", hdr->deleted ? "T" : "",
               NONULL (hdr->maildir_flags));
     if (hdr->maildir_flags)
-      qsort (tmp, mutt_strlen (tmp), 1, ch_compar);
+      qsort (tmp, safe_strlen (tmp), 1, ch_compar);
     snprintf (dest, destlen, ":2,%s", tmp);
   }
 }
@@ -1122,7 +1122,7 @@ int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr)
 
     if (safe_rename (msg->path, full) == 0) {
       if (hdr)
-        mutt_str_replace (&hdr->path, path);
+        str_replace (&hdr->path, path);
       FREE (&msg->path);
 
       /*
@@ -1208,7 +1208,7 @@ static int _mh_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr,
     snprintf (path, sizeof (path), "%s/%s", ctx->path, tmp);
     if (safe_rename (msg->path, path) == 0) {
       if (hdr)
-        mutt_str_replace (&hdr->path, tmp);
+        str_replace (&hdr->path, tmp);
       FREE (&msg->path);
       break;
     }
@@ -1289,7 +1289,7 @@ static int mh_rewrite_message (CONTEXT * ctx, int msgno)
     if (ctx->magic == M_MH && rc == 0) {
       snprintf (newpath, _POSIX_PATH_MAX, "%s/%s", ctx->path, h->path);
       if ((rc = safe_rename (newpath, oldpath)) == 0)
-        mutt_str_replace (&h->path, partpath);
+        str_replace (&h->path, partpath);
     }
   }
   else
@@ -1356,7 +1356,7 @@ static int maildir_sync_message (CONTEXT * ctx, int msgno)
     snprintf (fullpath, sizeof (fullpath), "%s/%s", ctx->path, partpath);
     snprintf (oldpath, sizeof (oldpath), "%s/%s", ctx->path, h->path);
 
-    if (mutt_strcmp (fullpath, oldpath) == 0) {
+    if (safe_strcmp (fullpath, oldpath) == 0) {
       /* message hasn't really changed */
       return 0;
     }
@@ -1368,7 +1368,7 @@ static int maildir_sync_message (CONTEXT * ctx, int msgno)
       mutt_perror ("rename");
       return (-1);
     }
-    mutt_str_replace (&h->path, partpath);
+    str_replace (&h->path, partpath);
   }
   return (0);
 }
@@ -1624,8 +1624,8 @@ int maildir_check_mailbox (CONTEXT * ctx, int *index_hint)
       /* check to see if the message has moved to a different
        * subdirectory.  If so, update the associated filename.
        */
-      if (mutt_strcmp (ctx->hdrs[i]->path, p->h->path))
-        mutt_str_replace (&ctx->hdrs[i]->path, p->h->path);
+      if (safe_strcmp (ctx->hdrs[i]->path, p->h->path))
+        str_replace (&ctx->hdrs[i]->path, p->h->path);
 
       /* if the user hasn't modified the flags on this message, update
        * the flags we just detected.
@@ -1809,7 +1809,7 @@ FILE *_maildir_open_find_message (const char *folder, const char *unique,
   while ((de = readdir (dp))) {
     maildir_canon_filename (tunique, de->d_name, sizeof (tunique));
 
-    if (!mutt_strcmp (tunique, unique)) {
+    if (!safe_strcmp (tunique, unique)) {
       snprintf (fname, sizeof (fname), "%s/%s/%s", folder, subfolder,
                 de->d_name);
       fp = fopen (fname, "r");  /* __FOPEN_CHECKED__ */
index bd7551e..6c341a6 100644 (file)
@@ -157,7 +157,7 @@ int mutt_addrlist_to_idna (ADDRESS * a, char **err)
         *err = safe_strdup (domain);
     }
     else {
-      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, safe_strlen (user) + safe_strlen (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
@@ -184,7 +184,7 @@ int mutt_addrlist_to_local (ADDRESS * a)
       continue;
 
     if (mutt_idna_to_local (domain, &tmp, 0) == 0) {
-      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, safe_strlen (user) + safe_strlen (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
@@ -218,7 +218,7 @@ const char *mutt_addr_for_display (ADDRESS * a)
     return a->mailbox;
   }
 
-  safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2);
+  safe_realloc (&buff, safe_strlen (tmp) + safe_strlen (user) + 2);
   sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
   FREE (&tmp);
   FREE (&user);
index fd2a05a..a9c2151 100644 (file)
@@ -187,7 +187,7 @@ int mutt_invoke_libesmtp (ADDRESS * from,       /* the sender */
 
   /* Create hostname:port string and tell libesmtp */
   /* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */
-  hostportlen = mutt_strlen (SmtpHost) + 7;
+  hostportlen = safe_strlen (SmtpHost) + 7;
   hostportstr = safe_malloc (hostportlen);
   snprintf (hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
   if (!smtp_set_server (session, hostportstr))
index 45fbf87..6bc3a29 100644 (file)
@@ -131,7 +131,7 @@ static int iptostring (const struct sockaddr *addr, socklen_t addrlen,
   if (ret)
     return getnameinfo_err (ret);
 
-  if (outlen < mutt_strlen (hbuf) + mutt_strlen (pbuf) + 2)
+  if (outlen < safe_strlen (hbuf) + safe_strlen (pbuf) + 2)
     return SASL_BUFOVER;
 
   snprintf (out, outlen, "%s;%s", hbuf, pbuf);
@@ -399,7 +399,7 @@ int mutt_sasl_interact (sasl_interact_t * interaction)
     if (mutt_get_field (prompt, resp, sizeof (resp), 0))
       return SASL_FAIL;
 
-    interaction->len = mutt_strlen (resp) + 1;
+    interaction->len = safe_strlen (resp) + 1;
     interaction->result = safe_malloc (interaction->len);
     memcpy (interaction->result, resp, interaction->len);
 
@@ -501,7 +501,7 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result,
   *result = account->user;
 
   if (len)
-    *len = mutt_strlen (*result);
+    *len = safe_strlen (*result);
 
   return SASL_OK;
 }
@@ -522,7 +522,7 @@ static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id,
   if (mutt_account_getpass (account))
     return SASL_FAIL;
 
-  len = mutt_strlen (account->pass);
+  len = safe_strlen (account->pass);
 
   *psecret = (sasl_secret_t *) safe_malloc (sizeof (sasl_secret_t) + len);
   (*psecret)->len = len;
index b9532ae..b231454 100644 (file)
@@ -108,7 +108,7 @@ int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg)
     return -1;
   }
 
-  len = mutt_strlen (buf);
+  len = safe_strlen (buf);
   if ((rc = conn->conn_write (conn, buf, len)) < 0) {
     dprint (1, (debugfile,
                 "mutt_socket_write: error writing, closing socket\n"));
@@ -179,7 +179,7 @@ int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn,
 
   dprint (dbg, (debugfile, "< %s\n", buf));
 
-  /* number of bytes read, not mutt_strlen */
+  /* number of bytes read, not safe_strlen */
   return i + 1;
 }
 
@@ -280,7 +280,7 @@ static int socket_preconnect (void)
   int rc;
   int save_errno;
 
-  if (mutt_strlen (Preconnect)) {
+  if (safe_strlen (Preconnect)) {
     dprint (2, (debugfile, "Executing preconnect: %s\n", Preconnect));
     rc = mutt_system (Preconnect);
     dprint (2, (debugfile, "Preconnect result: %d\n", rc));
index 0ea28c4..5196e48 100644 (file)
@@ -373,7 +373,7 @@ static char *x509_get_part (char *line, const char *ndx)
 
   c = strstr (line, ndx);
   if (c) {
-    c += mutt_strlen (ndx);
+    c += safe_strlen (ndx);
     c2 = strchr (c, '/');
     if (c2)
       *c2 = '\0';
index 7b6cb09..e160bd6 100644 (file)
@@ -412,8 +412,8 @@ static int tls_check_stored_hostname (const gnutls_datum * cert,
         if (regexec (&preg, linestr, 3, pmatch, 0) == 0) {
           linestr[pmatch[1].rm_eo] = '\0';
           linestr[pmatch[2].rm_eo] = '\0';
-          if (mutt_strcmp (linestr + pmatch[1].rm_so, hostname) == 0 &&
-              mutt_strcmp (linestr + pmatch[2].rm_so, buf) == 0) {
+          if (safe_strcmp (linestr + pmatch[1].rm_so, hostname) == 0 &&
+              safe_strcmp (linestr + pmatch[2].rm_so, buf) == 0) {
             regfree (&preg);
             FREE(&linestr);
             fclose (fp);
index 863f969..f13dd49 100644 (file)
@@ -93,7 +93,7 @@ static void mutt_nss_pretty_time (int64 usecs)
   t.tm_yday = ex.tm_yday;
 
   strfcpy (timebuf, asctime (&t), sizeof (timebuf));
-  timebuf[mutt_strlen (timebuf) - 1] = 0;
+  timebuf[safe_strlen (timebuf) - 1] = 0;
 
   addstr (timebuf);
 }
index 676b922..78d7103 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -85,7 +85,7 @@ void mutt_adv_mktemp (char *s, size_t l)
     mktemp (s);
     if (period != NULL) {
       *period = '.';
-      sl = mutt_strlen (s);
+      sl = safe_strlen (s);
       strfcpy (s + sl, period, l - sl);
     }
   }
@@ -277,7 +277,7 @@ void mutt_free_header (HEADER ** h)
 int mutt_matches_ignore (const char *s, LIST * t)
 {
   for (; t; t = t->next) {
-    if (!ascii_strncasecmp (s, t->data, mutt_strlen (t->data))
+    if (!ascii_strncasecmp (s, t->data, safe_strlen (t->data))
         || *t->data == '*')
       return 1;
   }
@@ -365,8 +365,8 @@ char *_mutt_expand_path (char *s, size_t slen, int rx)
 #ifdef USE_IMAP
         /* if folder = {host} or imap[s]://host/: don't append slash */
         if (mx_is_imap (NONULL (Maildir)) &&
-            (Maildir[mutt_strlen (Maildir) - 1] == '}' ||
-             Maildir[mutt_strlen (Maildir) - 1] == '/'))
+            (Maildir[safe_strlen (Maildir) - 1] == '}' ||
+             Maildir[safe_strlen (Maildir) - 1] == '/'))
           strfcpy (p, NONULL (Maildir), sizeof (p));
         else
 #endif
@@ -498,7 +498,7 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw)
   else
     strfcpy (dest, pw->pw_gecos, destlen);
 
-  pwnl = mutt_strlen (pw->pw_name);
+  pwnl = safe_strlen (pw->pw_name);
 
   for (idx = 0; dest[idx]; idx++) {
     if (dest[idx] == '&') {
@@ -534,7 +534,7 @@ void mutt_set_parameter (const char *attribute, const char *value,
 
   for (q = *p; q; q = q->next) {
     if (ascii_strcasecmp (attribute, q->attribute) == 0) {
-      mutt_str_replace (&q->value, value);
+      str_replace (&q->value, value);
       return;
     }
   }
@@ -709,15 +709,15 @@ void mutt_pretty_mailbox (char *s)
   }
   *q = 0;
 
-  if (mutt_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0 &&
+  if (safe_strncmp (s, Maildir, (len = safe_strlen (Maildir))) == 0 &&
       s[len] == '/') {
     *s++ = '=';
-    memmove (s, s + len, mutt_strlen (s + len) + 1);
+    memmove (s, s + len, safe_strlen (s + len) + 1);
   }
-  else if (mutt_strncmp (s, Homedir, (len = mutt_strlen (Homedir))) == 0 &&
+  else if (safe_strncmp (s, Homedir, (len = safe_strlen (Homedir))) == 0 &&
            s[len] == '/') {
     *s++ = '~';
-    memmove (s, s + len - 1, mutt_strlen (s + len - 1) + 1);
+    memmove (s, s + len - 1, safe_strlen (s + len - 1) + 1);
   }
 }
 
@@ -757,7 +757,7 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt,
   size_t slen;
   int found = 0;
 
-  slen = mutt_strlen (src);
+  slen = safe_strlen (src);
   destlen--;
 
   for (p = fmt, d = dest; destlen && *p; p++) {
@@ -815,7 +815,7 @@ int mutt_check_overwrite (const char *attname, const char *path,
               (_("File is a directory, save under it? [(y)es, (n)o, (a)ll]"),
                _("yna"))) {
       case 3:                  /* all */
-        mutt_str_replace (directory, fname);
+        str_replace (directory, fname);
         break;
       case 1:                  /* yes */
         FREE (directory);
@@ -875,7 +875,7 @@ void mutt_save_path (char *d, size_t dsize, ADDRESS * a)
       if ((p = strpbrk (d, "%@")))
         *p = 0;
     }
-    mutt_strlower (d);
+    str_tolower (d);
   }
   else
     *d = 0;
@@ -909,7 +909,7 @@ int mutt_skipchars (const char *s, const char *c)
     ret++;
     s++;
   }
-  return (mutt_strlen (p));
+  return (safe_strlen (p));
 }
 
 void mutt_FormatString (char *dest,     /* output buffer */
@@ -1009,7 +1009,7 @@ void mutt_FormatString (char *dest,     /* output buffer */
         if (count > col) {
           count -= col;         /* how many columns left on this line */
           mutt_FormatString (buf, sizeof (buf), src, callback, data, flags);
-          wid = mutt_strlen (buf);
+          wid = safe_strlen (buf);
           if (count > wid) {
             count -= wid;       /* how many chars to pad */
             memset (wptr, ch, count);
@@ -1058,7 +1058,7 @@ void mutt_FormatString (char *dest,     /* output buffer */
                     data, flags);
 
         if (tolower)
-          mutt_strlower (buf);
+          str_tolower (buf);
         if (nodots) {
           char *p = buf;
 
@@ -1067,7 +1067,7 @@ void mutt_FormatString (char *dest,     /* output buffer */
               *p = '_';
         }
 
-        if ((len = mutt_strlen (buf)) + wlen > destlen)
+        if ((len = safe_strlen (buf)) + wlen > destlen)
           len = (destlen - wlen > 0) ? (destlen - wlen) : 0;
 
         memcpy (wptr, buf, len);
@@ -1138,7 +1138,7 @@ FILE *mutt_open_read (const char *path, pid_t * thepid)
   FILE *f;
   struct stat s;
 
-  int len = mutt_strlen (path);
+  int len = safe_strlen (path);
 
   if (path[len - 1] == '|') {
     /* read from a pipe */
@@ -1196,7 +1196,7 @@ int mutt_save_confirm (const char *s, struct stat *st)
     }
 
     if (option (OPTCONFIRMAPPEND) &&
-        (!TrashPath || (mutt_strcmp (s, TrashPath) != 0)))
+        (!TrashPath || (safe_strcmp (s, TrashPath) != 0)))
       /* if we're appending to the trash, there's no point in asking */
     {
       snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s);
@@ -1239,7 +1239,7 @@ void state_prefix_putc (char c, STATE * s)
   if (s->flags & M_PENDINGPREFIX) {
     int i;
 
-    i = mutt_strlen (Quotebuf);
+    i = safe_strlen (Quotebuf);
     Quotebuf[i++] = c;
     Quotebuf[i] = '\0';
     if (i == sizeof (Quotebuf) - 1 || c == '\n') {
@@ -1293,7 +1293,7 @@ int state_printf (STATE * s, const char *fmt, ...)
 
 void state_mark_attach (STATE * s)
 {
-  if ((s->flags & M_DISPLAY) && !mutt_strcmp (Pager, "builtin"))
+  if ((s->flags & M_DISPLAY) && !safe_strcmp (Pager, "builtin"))
     state_puts (AttachmentMarker, s);
 }
 
@@ -1361,14 +1361,14 @@ BUFFER *mutt_buffer_from (BUFFER * b, char *seed)
 
   b = mutt_buffer_init (b);
   b->data = safe_strdup (seed);
-  b->dsize = mutt_strlen (seed);
+  b->dsize = safe_strlen (seed);
   b->dptr = (char *) b->data + b->dsize;
   return b;
 }
 
 void mutt_buffer_addstr (BUFFER * buf, const char *s)
 {
-  mutt_buffer_add (buf, s, mutt_strlen (s));
+  mutt_buffer_add (buf, s, safe_strlen (s));
 }
 
 void mutt_buffer_addch (BUFFER * buf, char c)
diff --git a/mx.c b/mx.c
index 1cf7078..cd1957a 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -65,7 +65,7 @@
 #endif
 
 
-#define mutt_is_spool(s)  (mutt_strcmp (Spoolfile, s) == 0)
+#define mutt_is_spool(s)  (safe_strcmp (Spoolfile, s) == 0)
 
 #ifdef USE_DOTLOCK
 /* parameters: 
@@ -447,9 +447,9 @@ int mx_get_magic (const char *path)
 #endif
 
     fgets (tmp, sizeof (tmp), f);
-    if (mutt_strncmp ("From ", tmp, 5) == 0)
+    if (safe_strncmp ("From ", tmp, 5) == 0)
       magic = M_MBOX;
-    else if (mutt_strcmp (MMDF_SEP, tmp) == 0)
+    else if (safe_strcmp (MMDF_SEP, tmp) == 0)
       magic = M_MMDF;
     safe_fclose (&f);
 #ifndef BUFFY_SIZE
index 22ff5a2..e20fff2 100644 (file)
@@ -74,7 +74,7 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line)
   strfcpy (group, line, len);
   if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) {
     data =
-      (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (group) + 1);
+      (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + safe_strlen (group) + 1);
     data->group = (char *) data + sizeof (NNTP_DATA);
     strcpy (data->group, group);
     data->nserv = news;
@@ -205,9 +205,9 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
     return 0;
   rewind (index);
   while (fgets (buf, sizeof (buf), index)) {
-    buf[mutt_strlen (buf) - 1] = 0;  /* strip ending '\n' */
-    if (!mutt_strncmp (buf, "#: ", 3) &&
-        !mutt_strcasecmp (buf + 3, news->conn->account.host))
+    buf[safe_strlen (buf) - 1] = 0;  /* strip ending '\n' */
+    if (!safe_strncmp (buf, "#: ", 3) &&
+        !safe_strcasecmp (buf + 3, news->conn->account.host))
       break;
   }
   while (fgets (buf, sizeof (buf), index)) {
@@ -217,10 +217,10 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
     if (!*cp)
       continue;
     cp[0] = 0;
-    if (!mutt_strcmp (buf, "#:"))
+    if (!safe_strcmp (buf, "#:"))
       break;
     sscanf (cp + 1, "%s %d %d", file, &l, &m);
-    if (!mutt_strcmp (buf, "ALL")) {
+    if (!safe_strcmp (buf, "ALL")) {
       news->cache = safe_strdup (file);
       news->newgroups_time = m;
     }
@@ -228,7 +228,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
       if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) {
         data =
           (NNTP_DATA *) safe_calloc (1,
-                                     sizeof (NNTP_DATA) + mutt_strlen (buf) + 1);
+                                     sizeof (NNTP_DATA) + safe_strlen (buf) + 1);
         data->group = (char *) data + sizeof (NNTP_DATA);
         strcpy (data->group, buf);
         data->nserv = news;
@@ -266,7 +266,7 @@ const char *nntp_format_str (char *dest, size_t destlen, char op,
   switch (op) {
   case 's':
     strncpy (fn, NewsServer, sizeof (fn) - 1);
-    mutt_strlower (fn);
+    str_tolower (fn);
     snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
     snprintf (dest, destlen, tmp, fn);
     break;
@@ -343,7 +343,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server)
     return NULL;
   }
 
-  buf = p = safe_calloc (mutt_strlen (server) + 10, sizeof (char));
+  buf = p = safe_calloc (safe_strlen (server) + 10, sizeof (char));
   if (url_check_scheme (server) == U_UNKNOWN) {
     strcpy (buf, "nntp://");
     p = strchr (buf, '\0');
@@ -512,8 +512,8 @@ static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf,
     line = *buf + (*pline - line);
   }
   strcpy (line, data->group);
-  len -= mutt_strlen (line) + 1;
-  line += mutt_strlen (line);
+  len -= safe_strlen (line) + 1;
+  line += safe_strlen (line);
   *line++ = data->subscribed ? ':' : '!';
   *line++ = ' ';
   *line = '\0';
@@ -646,7 +646,7 @@ int mutt_newsrc_update (NNTP_SERVER * news)
       continue;
     nntp_create_newsrc_line (data, &buf, &line, &llen);
     dprint (2, (debugfile, "Added to newsrc: %s", line));
-    line += mutt_strlen (line);
+    line += safe_strlen (line);
   }
   /* newrc being fully rewritten */
   if (news->newsrc &&
@@ -672,7 +672,7 @@ static FILE *mutt_mkname (char *s)
     return fp;
 
   nntp_cache_expand (buf, "cache-XXXXXX");
-  pc = buf + mutt_strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
+  pc = buf + safe_strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
   if ((fd = mkstemp (buf)) == -1)
     return NULL;
   strcpy (s, pc);               /* generated name */
@@ -879,7 +879,7 @@ NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER * news, char *group)
     return NULL;
   if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) {
     data =
-      (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (group) + 1);
+      (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + safe_strlen (group) + 1);
     data->group = (char *) data + sizeof (NNTP_DATA);
     strcpy (data->group, group);
     data->nserv = news;
@@ -972,7 +972,7 @@ void nntp_buffy (char *s)
 
     if (data && data->subscribed && data->unread) {
       if (Context && Context->magic == M_NNTP &&
-          !mutt_strcmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
+          !safe_strcmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
         unsigned int i, unread = 0;
 
         for (i = 0; i < Context->msgcount; i++)
index 5fbe0c7..03c57d8 100644 (file)
@@ -84,7 +84,7 @@ static int nntp_auth (NNTP_SERVER * serv)
     return -1;
   }
 
-  if (mutt_strncmp ("281", buf, 3)) {
+  if (safe_strncmp ("281", buf, 3)) {
     conn->account.flags = flags;
     mutt_error _("Login failed.");
 
@@ -119,9 +119,9 @@ static int nntp_connect_and_auth (NNTP_SERVER * serv)
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
     return nntp_connect_error (serv);
 
-  if (!mutt_strncmp ("200", buf, 3))
+  if (!safe_strncmp ("200", buf, 3))
     mutt_message (_("Connected to %s. Posting ok."), conn->account.host);
-  else if (!mutt_strncmp ("201", buf, 3))
+  else if (!safe_strncmp ("201", buf, 3))
     mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
   else {
     mutt_socket_close (conn);
@@ -143,7 +143,7 @@ static int nntp_connect_and_auth (NNTP_SERVER * serv)
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
     return nntp_connect_error (serv);
 
-  if (!(conn->account.flags & M_ACCT_USER) && mutt_strncmp ("480", buf, 3)) {
+  if (!(conn->account.flags & M_ACCT_USER) && safe_strncmp ("480", buf, 3)) {
     serv->status = NNTP_OK;
     return 0;
   }
@@ -175,28 +175,28 @@ static int nntp_attempt_features (NNTP_SERVER * serv)
   mutt_socket_write (conn, "LISTGROUP\r\n");
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
     return (nntp_connect_error (serv));
-  if (mutt_strncmp ("500", buf, 3))
+  if (safe_strncmp ("500", buf, 3))
     serv->hasLISTGROUP = 1;
 
   mutt_socket_write (conn, "XOVER\r\n");
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
     return nntp_connect_error (serv);
-  if (mutt_strncmp ("500", buf, 3))
+  if (safe_strncmp ("500", buf, 3))
     serv->hasXOVER = 1;
 
   mutt_socket_write (conn, "XPAT\r\n");
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
     return nntp_connect_error (serv);
-  if (mutt_strncmp ("500", buf, 3))
+  if (safe_strncmp ("500", buf, 3))
     serv->hasXPAT = 1;
 
   mutt_socket_write (conn, "XGTITLE +\r\n");
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
     return nntp_connect_error (serv);
-  if (mutt_strncmp ("500", buf, 3))
+  if (safe_strncmp ("500", buf, 3))
     serv->hasXGTITLE = 1;
 
-  if (!mutt_strncmp ("282", buf, 3)) {
+  if (!safe_strncmp ("282", buf, 3)) {
     do {
       if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
         return nntp_connect_error (serv);
@@ -270,7 +270,7 @@ static int mutt_nntp_query (NNTP_DATA * data, char *line, size_t linelen)
       if (*line)
         done = FALSE;
     }
-    else if ((!mutt_strncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0)
+    else if ((!safe_strncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0)
       return -1;
   } while (!done);
 
@@ -331,7 +331,7 @@ static int mutt_nntp_fetch (NNTP_DATA * nntp_data, char *query, char *msg,
       strfcpy (inbuf + lenbuf, p, sizeof (buf));
 
       if (chunk >= sizeof (buf)) {
-        lenbuf += mutt_strlen (p);
+        lenbuf += safe_strlen (p);
       }
       else {
         line++;
@@ -398,7 +398,7 @@ static void nntp_parse_xref (CONTEXT * ctx, char *group, char *xref,
       *colon = '\0';
       colon++;
       nntp_get_status (ctx, h, p, atoi (colon));
-      if (h && h->article_num == 0 && mutt_strcmp (group, b) == 0)
+      if (h && h->article_num == 0 && safe_strcmp (group, b) == 0)
         h->article_num = atoi (colon);
     }
   }
@@ -472,7 +472,7 @@ static int parse_description (char *line, void *n)
     d++;
   dprint (2, (debugfile, "group: %s, desc: %s\n", line, d));
   if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
-      mutt_strcmp (d, data->desc)) {
+      safe_strcmp (d, data->desc)) {
     FREE (&data->desc);
     data->desc = safe_strdup (d);
   }
@@ -826,7 +826,7 @@ int nntp_open_mailbox (CONTEXT * ctx)
 
   /* create NNTP-specific state struct if nof found in list */
   if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) {
-    nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (buf) + 1);
+    nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + safe_strlen (buf) + 1);
     nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
     strcpy (nntp_data->group, buf);
     hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
@@ -851,11 +851,11 @@ int nntp_open_mailbox (CONTEXT * ctx)
     return -1;
   }
 
-  if (mutt_strncmp ("211", buf, 3)) {
+  if (safe_strncmp ("211", buf, 3)) {
     LIST *l = serv->list;
 
     /* GROUP command failed */
-    if (!mutt_strncmp ("411", buf, 3)) {
+    if (!safe_strncmp ("411", buf, 3)) {
       mutt_error (_("Newsgroup %s not found on server %s"),
                   nntp_data->group, serv->conn->account.host);
 
@@ -1013,7 +1013,7 @@ int nntp_post (const char *msg)
   buf[0] = '.';
   buf[1] = '\0';
   while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) {
-    len = mutt_strlen (buf);
+    len = safe_strlen (buf);
     if (buf[len - 1] == '\n') {
       buf[len - 1] = '\r';
       buf[len] = '\n';
@@ -1027,7 +1027,7 @@ int nntp_post (const char *msg)
   }
   fclose (f);
 
-  if (buf[mutt_strlen (buf) - 1] != '\n')
+  if (buf[safe_strlen (buf) - 1] != '\n')
     mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR);
   mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR);
   if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) {
@@ -1170,7 +1170,7 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
 #endif
     return -1;
   }
-  if (mutt_strncmp ("211", buf, 3)) {
+  if (safe_strncmp ("211", buf, 3)) {
     buf[0] = 0;
     if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
 #ifdef DEBUG
@@ -1179,7 +1179,7 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
       return -1;
     }
   }
-  if (!mutt_strncmp ("211", buf, 3)) {
+  if (!safe_strncmp ("211", buf, 3)) {
     int first;
     int last;
 
@@ -1238,7 +1238,7 @@ static int add_group (char *buf, void *serv)
     return 0;
   if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL) {
     n++;
-    nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + mutt_strlen (group) + 1);
+    nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + safe_strlen (group) + 1);
     nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
     strcpy (nntp_data->group, group);
     nntp_data->nserv = s;
diff --git a/pager.c b/pager.c
index c7cd750..78fe31d 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -390,7 +390,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
     if (length <= q_list->length) {
       /* case 1: check the top level nodes */
 
-      if (mutt_strncmp (qptr, q_list->prefix, length) == 0) {
+      if (safe_strncmp (qptr, q_list->prefix, length) == 0) {
         if (length == q_list->length)
           return q_list;        /* same prefix: return the current class */
 
@@ -479,7 +479,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
 
       /* tmp != NULL means we already found a shorter prefix at case 1 */
       if (tmp == NULL
-          && mutt_strncmp (qptr, q_list->prefix, q_list->length) == 0) {
+          && safe_strncmp (qptr, q_list->prefix, q_list->length) == 0) {
         /* ok, it's a subclass somewhere on this branch */
 
         ptr = q_list;
@@ -491,7 +491,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
 
         while (q_list) {
           if (length <= q_list->length) {
-            if (mutt_strncmp (tail_qptr, (q_list->prefix) + offset, tail_lng)
+            if (safe_strncmp (tail_qptr, (q_list->prefix) + offset, tail_lng)
                 == 0) {
               /* same prefix: return the current class */
               if (length == q_list->length)
@@ -575,7 +575,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
           else {
             /* longer than the current prefix: try subclassing it */
             if (tmp == NULL
-                && mutt_strncmp (tail_qptr, (q_list->prefix) + offset,
+                && safe_strncmp (tail_qptr, (q_list->prefix) + offset,
                                  q_list->length - offset) == 0) {
               /* still a subclass: go down one level */
               ptr = q_list;
@@ -681,17 +681,17 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last,
       }
     }
   }
-  else if (mutt_strncmp ("\033[0m", raw, 4) == 0)       /* a little hack... */
+  else if (safe_strncmp ("\033[0m", raw, 4) == 0)       /* a little hack... */
     lineInfo[n].type = MT_COLOR_NORMAL;
 #if 0
-  else if (mutt_strncmp ("[-- ", buf, 4) == 0)
+  else if (safe_strncmp ("[-- ", buf, 4) == 0)
     lineInfo[n].type = MT_COLOR_ATTACHMENT;
 #else
   else if (check_attachment_marker ((char *) raw) == 0)
     lineInfo[n].type = MT_COLOR_ATTACHMENT;
 #endif
-  else if (mutt_strcmp ("-- \n", buf) == 0
-           || mutt_strcmp ("-- \r\n", buf) == 0) {
+  else if (safe_strcmp ("-- \n", buf) == 0
+           || safe_strcmp ("-- \r\n", buf) == 0) {
     i = n + 1;
 
     lineInfo[n].type = MT_COLOR_SIGNATURE;
@@ -2332,7 +2332,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
       else
         followup_to = extra->hdr->env->followup_to;
 
-      if (!followup_to || mutt_strcasecmp (followup_to, "poster") ||
+      if (!followup_to || safe_strcasecmp (followup_to, "poster") ||
           query_quadoption (OPT_FOLLOWUPTOPOSTER,
                             _("Reply by mail as poster prefers?")) != M_YES) {
         if (extra->ctx && extra->ctx->magic == M_NNTP
diff --git a/parse.c b/parse.c
index 64b22f4..5abfb06 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -46,7 +46,7 @@ static char *read_rfc822_line (FILE * f, char *line, size_t * linelen)
       return (line);
     }
 
-    buf += mutt_strlen (buf) - 1;
+    buf += safe_strlen (buf) - 1;
     if (*buf == '\n') {
       /* we did get a full line. remove trailing space */
       while (ISSPACE (*buf))
@@ -95,7 +95,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to)
     new = NULL;
 
     if (*s == '<') {
-      n = mutt_strlen (s);
+      n = safe_strlen (s);
       if (s[n - 1] != '>') {
         o = s;
         s = NULL;
@@ -105,7 +105,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to)
       new = safe_strdup (s);
     }
     else if (o) {
-      m = mutt_strlen (s);
+      m = safe_strlen (s);
       if (s[m - 1] == '>') {
         new = safe_malloc (sizeof (char) * (n + m + 1));
         strcpy (new, o);        /* __STRCPY_CHECKED__ */
@@ -397,7 +397,7 @@ static void parse_content_disposition (char *s, BODY * ct)
     if ((s =
          mutt_get_parameter ("filename",
                              (parms = parse_parameters (s)))) != 0)
-      mutt_str_replace (&ct->filename, s);
+      str_replace (&ct->filename, s);
     if ((s = mutt_get_parameter ("name", parms)) != 0)
       ct->form_name = safe_strdup (s);
     mutt_free_parameter (&parms);
@@ -452,7 +452,7 @@ BODY *mutt_read_mime_header (FILE * fp, int digest)
       else if (!ascii_strcasecmp ("disposition", line + 8))
         parse_content_disposition (c, p);
       else if (!ascii_strcasecmp ("description", line + 8)) {
-        mutt_str_replace (&p->description, c);
+        str_replace (&p->description, c);
         rfc2047_decode (&p->description);
       }
     }
@@ -465,7 +465,7 @@ BODY *mutt_read_mime_header (FILE * fp, int digest)
       else if (!ascii_strcasecmp ("content-lines", line + 6))
         mutt_set_parameter ("content-lines", c, &(p->parameter));
       else if (!ascii_strcasecmp ("data-description", line + 6)) {
-        mutt_str_replace (&p->description, c);
+        str_replace (&p->description, c);
         rfc2047_decode (&p->description);
       }
     }
@@ -521,7 +521,7 @@ void mutt_parse_part (FILE * fp, BODY * b)
   /* try to recover from parsing error */
   if (!b->parts) {
     b->type = TYPETEXT;
-    mutt_str_replace (&b->subtype, "plain");
+    str_replace (&b->subtype, "plain");
   }
 }
 
@@ -589,14 +589,14 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off,
     return (NULL);
   }
 
-  blen = mutt_strlen (boundary);
+  blen = safe_strlen (boundary);
   while (ftell (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) {
-    len = mutt_strlen (buffer);
+    len = safe_strlen (buffer);
 
     crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0;
 
     if (buffer[0] == '-' && buffer[1] == '-' &&
-        mutt_strncmp (buffer + 2, boundary, blen) == 0) {
+        safe_strncmp (buffer + 2, boundary, blen) == 0) {
       if (last) {
         last->length = ftell (fp) - last->offset - len - 1 - crlf;
         if (last->parts && last->parts->length == 0)
@@ -612,7 +612,7 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off,
         buffer[i] = 0;
 
       /* Check for the end boundary */
-      if (mutt_strcmp (buffer + blen + 2, "--") == 0) {
+      if (safe_strcmp (buffer + blen + 2, "--") == 0) {
         final = 1;
         break;                  /* done parsing */
       }
@@ -1004,7 +1004,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
       }
       else if (ascii_strcasecmp (line + 8, "description") == 0) {
         if (hdr) {
-          mutt_str_replace (&hdr->content->description, p);
+          str_replace (&hdr->content->description, p);
           rfc2047_decode (&hdr->content->description);
         }
         matched = 1;
@@ -1019,7 +1019,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
 
   case 'd':
     if (!ascii_strcasecmp ("ate", line + 1)) {
-      mutt_str_replace (&e->date, p);
+      str_replace (&e->date, p);
       if (hdr)
         hdr->date_sent = mutt_parse_date (p, hdr);
       matched = 1;
@@ -1046,7 +1046,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
       matched = 1;
     }
 #ifdef USE_NNTP
-    else if (!mutt_strcasecmp (line + 1, "ollowup-to")) {
+    else if (!safe_strcasecmp (line + 1, "ollowup-to")) {
       if (!e->followup_to) {
         mutt_remove_trailing_ws (p);
         e->followup_to = safe_strdup (mutt_skip_whitespace (p));
@@ -1092,7 +1092,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) {
             FREE (&e->list_post);
-            e->list_post = mutt_substrdup (beg, end);
+            e->list_post = str_substrdup (beg, end);
             break;
           }
         }
@@ -1129,7 +1129,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
 
 #ifdef USE_NNTP
   case 'n':
-    if (!mutt_strcasecmp (line + 1, "ewsgroups")) {
+    if (!safe_strcasecmp (line + 1, "ewsgroups")) {
       FREE (&e->newsgroups);
       mutt_remove_trailing_ws (p);
       e->newsgroups = safe_strdup (mutt_skip_whitespace (p));
@@ -1140,8 +1140,8 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
 
   case 'o':
     /* field `Organization:' saves only for pager! */
-    if (!mutt_strcasecmp (line + 1, "rganization")) {
-      if (!e->organization && mutt_strcasecmp (p, "unknown"))
+    if (!safe_strcasecmp (line + 1, "rganization")) {
+      if (!e->organization && safe_strcasecmp (p, "unknown"))
         e->organization = safe_strdup (p);
     }
     break;
@@ -1238,12 +1238,12 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
       matched = 1;
     }
 #ifdef USE_NNTP
-    else if (!mutt_strcasecmp (line + 1, "-comment-to")) {
+    else if (!safe_strcasecmp (line + 1, "-comment-to")) {
       if (!e->x_comment_to)
         e->x_comment_to = safe_strdup (p);
       matched = 1;
     }
-    else if (!mutt_strcasecmp (line + 1, "ref")) {
+    else if (!safe_strcasecmp (line + 1, "ref")) {
       if (!e->xref)
         e->xref = safe_strdup (p);
       matched = 1;
@@ -1257,7 +1257,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
   /* Keep track of the user-defined headers */
   if (!matched && user_hdrs) {
     /* restore the original line */
-    line[mutt_strlen (line)] = ':';
+    line[safe_strlen (line)] = ':';
 
     if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore)
         && !mutt_matches_ignore (line, UnIgnore))
@@ -1335,7 +1335,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE * f, HEADER * hdr, short user_hdrs,
       time_t t;
 
       /* some bogus MTAs will quote the original "From " line */
-      if (mutt_strncmp (">From ", line, 6) == 0)
+      if (safe_strncmp (">From ", line, 6) == 0)
         continue;               /* just ignore */
       else if (is_from (line, return_path, sizeof (return_path), &t)) {
         /* MH somtimes has the From_ line in the middle of the header! */
index d9e8a2a..be05a18 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -204,7 +204,7 @@ msg_search (CONTEXT * ctx, regex_t * rx, char *buf, size_t blen, int op,
         match = 1;
         break;
       }
-      lng -= mutt_strlen (buf);
+      lng -= safe_strlen (buf);
     }
 
     mx_close_message (&msg);
@@ -667,7 +667,7 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err)
 
   memset (&ps, 0, sizeof (ps));
   ps.dptr = s;
-  ps.dsize = mutt_strlen (s);
+  ps.dsize = safe_strlen (s);
 
   while (*ps.dptr) {
     SKIPWS (ps.dptr);
@@ -766,7 +766,7 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err)
         return NULL;
       }
       /* compile the sub-expression */
-      buf = mutt_substrdup (ps.dptr + 1, p);
+      buf = str_substrdup (ps.dptr + 1, p);
       if ((tmp = mutt_pattern_comp (buf, flags, err)) == NULL) {
         FREE (&buf);
         mutt_pattern_free (&curlist);
@@ -1098,7 +1098,7 @@ void mutt_check_simple (char *s, size_t len, const char *simple)
 
   if (!strchr (s, '~')) {       /* yup, so spoof a real request */
     /* convert old tokens into the new format */
-    if (ascii_strcasecmp ("all", s) == 0 || !mutt_strcmp ("^", s) || !mutt_strcmp (".", s))     /* ~A is more efficient */
+    if (ascii_strcasecmp ("all", s) == 0 || !safe_strcmp ("^", s) || !safe_strcmp (".", s))     /* ~A is more efficient */
       strfcpy (s, "~A", len);
     else if (ascii_strcasecmp ("del", s) == 0)
       strfcpy (s, "~D", len);
@@ -1218,7 +1218,7 @@ int mutt_pattern_func (int op, char *prompt)
       }
 #endif
     }
-    else if (mutt_strncmp (buf, "~A", 2) != 0) {
+    else if (safe_strncmp (buf, "~A", 2) != 0) {
       Context->pattern = simple;
       simple = NULL;            /* don't clobber it */
       Context->limit_pattern = mutt_pattern_comp (buf, M_FULL_MSG, &err);
@@ -1256,7 +1256,7 @@ int mutt_search_command (int cur, int op)
     strfcpy (temp, buf, sizeof (temp));
     mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch));
 
-    if (!SearchPattern || mutt_strcmp (temp, LastSearchExpn)) {
+    if (!SearchPattern || safe_strcmp (temp, LastSearchExpn)) {
       set_option (OPTSEARCHINVALID);
       strfcpy (LastSearch, buf, sizeof (LastSearch));
       mutt_message _("Compiling search pattern...");
diff --git a/pgp.c b/pgp.c
index ed9a0c8..04f5800 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -197,7 +197,7 @@ static void pgp_copy_clearsigned (FILE * fpin, STATE * s, char *charset)
       continue;
     }
 
-    if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
+    if (safe_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
       break;
 
     if (armor_header) {
@@ -253,21 +253,21 @@ void pgp_application_pgp_handler (BODY * m, STATE * s)
       break;
 
     offset = ftell (s->fpin);
-    bytes -= (offset - last_pos);       /* don't rely on mutt_strlen(buf) */
+    bytes -= (offset - last_pos);       /* don't rely on safe_strlen(buf) */
     last_pos = offset;
 
-    if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0) {
+    if (safe_strncmp ("-----BEGIN PGP ", buf, 15) == 0) {
       clearsign = 0;
       start_pos = last_pos;
 
-      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+      if (safe_strcmp ("MESSAGE-----\n", buf + 15) == 0)
         needpass = 1;
-      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) {
+      else if (safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) {
         clearsign = 1;
         needpass = 0;
       }
       else if (!option (OPTDONTHANDLEPGPKEYS) &&
-               mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) {
+               safe_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) {
         needpass = 0;
         pgp_keyblock = 1;
       }
@@ -291,16 +291,16 @@ void pgp_application_pgp_handler (BODY * m, STATE * s)
       fputs (buf, tmpfp);
       while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) {
         offset = ftell (s->fpin);
-        bytes -= (offset - last_pos);   /* don't rely on mutt_strlen(buf) */
+        bytes -= (offset - last_pos);   /* don't rely on safe_strlen(buf) */
         last_pos = offset;
 
         fputs (buf, tmpfp);
 
         if ((needpass
-             && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0)
+             && safe_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0)
             || (!needpass
-                && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
-                    || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
+                && (safe_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
+                    || safe_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
                                     buf) == 0)))
           break;
       }
@@ -465,12 +465,12 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b,
   }
 
   while (fgets (buf, sizeof (buf), tfp)) {
-    if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0) {
-      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+    if (safe_strncmp ("-----BEGIN PGP ", buf, 15) == 0) {
+      if (safe_strcmp ("MESSAGE-----\n", buf + 15) == 0)
         enc = 1;
-      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+      else if (safe_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
         sgn = 1;
-      else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
+      else if (safe_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
         key = 1;
     }
   }
@@ -741,7 +741,7 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p)
    * read_mime_header has a hard time parsing the message.
    */
   while (fgets (buf, sizeof (buf) - 1, pgpout) != NULL) {
-    len = mutt_strlen (buf);
+    len = safe_strlen (buf);
     if (len > 1 && buf[len - 2] == '\r')
       strcpy (buf + len - 2, "\n");     /* __STRCPY_CHECKED__ */
     fputs (buf, fpout);
@@ -939,9 +939,9 @@ BODY *pgp_sign_message (BODY * a)
    * recommended for future releases of PGP.
    */
   while (fgets (buffer, sizeof (buffer) - 1, pgpout) != NULL) {
-    if (mutt_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
+    if (safe_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
       fputs ("-----BEGIN PGP SIGNATURE-----\n", fp);
-    else if (mutt_strcmp ("-----END PGP MESSAGE-----\n", buffer) == 0)
+    else if (safe_strcmp ("-----END PGP MESSAGE-----\n", buffer) == 0)
       fputs ("-----END PGP SIGNATURE-----\n", fp);
     else
       fputs (buffer, fp);
@@ -1010,7 +1010,7 @@ static short is_numerical_keyid (const char *s)
   /* or should we require the "0x"? */
   if (strncmp (s, "0x", 2) == 0)
     s += 2;
-  if (mutt_strlen (s) % 8)
+  if (safe_strlen (s) % 8)
     return 0;
   while (*s)
     if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL)
@@ -1118,11 +1118,11 @@ char *pgp_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
     keyID = pgp_keyid (key);
 
   bypass_selection:
-    keylist_size += mutt_strlen (keyID) + 4;
+    keylist_size += safe_strlen (keyID) + 4;
     safe_realloc (&keylist, keylist_size);
     sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */
              keyID);
-    keylist_used = mutt_strlen (keylist);
+    keylist_used = safe_strlen (keylist);
 
     pgp_free_key (&key);
     rfc822_free_address (&addr);
@@ -1461,7 +1461,7 @@ int pgp_send_menu (HEADER * msg, int *redraw)
          pgp_ask_for_key (_("Sign as: "), NULL, KEYFLAG_CANSIGN,
                           PGP_PUBRING))) {
       snprintf (input_signas, sizeof (input_signas), "0x%s", pgp_keyid (p));
-      mutt_str_replace (&PgpSignAs, input_signas);
+      str_replace (&PgpSignAs, input_signas);
       pgp_free_key (&p);
 
       msg->security |= SIGN;
index daa3a24..8e8f253 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -277,10 +277,10 @@ static int _pgp_compare_address (const void *a, const void *b)
   pgp_uid_t **s = (pgp_uid_t **) a;
   pgp_uid_t **t = (pgp_uid_t **) b;
 
-  if ((r = mutt_strcasecmp ((*s)->addr, (*t)->addr)))
+  if ((r = safe_strcasecmp ((*s)->addr, (*t)->addr)))
     return r > 0;
   else
-    return (mutt_strcasecmp (_pgp_keyid ((*s)->parent),
+    return (safe_strcasecmp (_pgp_keyid ((*s)->parent),
                              _pgp_keyid ((*t)->parent)) > 0);
 }
 
@@ -299,11 +299,11 @@ static int _pgp_compare_keyid (const void *a, const void *b)
   pgp_uid_t **s = (pgp_uid_t **) a;
   pgp_uid_t **t = (pgp_uid_t **) b;
 
-  if ((r = mutt_strcasecmp (_pgp_keyid ((*s)->parent),
+  if ((r = safe_strcasecmp (_pgp_keyid ((*s)->parent),
                             _pgp_keyid ((*t)->parent))))
     return r > 0;
   else
-    return (mutt_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
+    return (safe_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
 }
 
 static int pgp_compare_keyid (const void *a, const void *b)
@@ -320,7 +320,7 @@ static int _pgp_compare_date (const void *a, const void *b)
 
   if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
     return r > 0;
-  return (mutt_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
+  return (safe_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
 }
 
 static int pgp_compare_date (const void *a, const void *b)
@@ -345,9 +345,9 @@ static int _pgp_compare_trust (const void *a, const void *b)
     return r < 0;
   if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
     return r < 0;
-  if ((r = mutt_strcasecmp ((*s)->addr, (*t)->addr)))
+  if ((r = safe_strcasecmp ((*s)->addr, (*t)->addr)))
     return r > 0;
-  return (mutt_strcasecmp (_pgp_keyid ((*s)->parent),
+  return (safe_strcasecmp (_pgp_keyid ((*s)->parent),
                            _pgp_keyid ((*t)->parent))) > 0;
 }
 
@@ -406,11 +406,11 @@ static int pgp_id_matches_addr (ADDRESS * addr, ADDRESS * u_addr,
     rv |= PGP_KV_STRONGID;
 
   if (addr->mailbox && u_addr->mailbox
-      && mutt_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
+      && safe_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
     rv |= PGP_KV_ADDR;
 
   if (addr->personal && u_addr->personal
-      && mutt_strcasecmp (addr->personal, u_addr->personal) == 0)
+      && safe_strcasecmp (addr->personal, u_addr->personal) == 0)
     rv |= PGP_KV_STRING;
 
   return rv;
@@ -641,7 +641,7 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor,
   if (whatfor) {
 
     for (l = id_defaults; l; l = l->next)
-      if (!mutt_strcasecmp (whatfor, l->what)) {
+      if (!safe_strcasecmp (whatfor, l->what)) {
         strfcpy (resp, NONULL (l->dflt), sizeof (resp));
         break;
       }
@@ -655,7 +655,7 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor,
 
     if (whatfor) {
       if (l)
-        mutt_str_replace (&l->dflt, resp);
+        str_replace (&l->dflt, resp);
       else {
         l = safe_malloc (sizeof (struct pgp_cache));
         l->next = id_defaults;
@@ -762,7 +762,7 @@ static LIST *pgp_add_string_to_hints (LIST * hints, const char *str)
 
   for (t = strtok (scratch, " ,.:\"()<>\n"); t;
        t = strtok (NULL, " ,.:\"()<>\n")) {
-    if (mutt_strlen (t) > 3)
+    if (safe_strlen (t) > 3)
       hints = mutt_add_list (hints, t);
   }
 
@@ -932,12 +932,12 @@ pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring)
               (debugfile,
                "pgp_getkeybystr: matching \"%s\" against key %s, \"%s\": ", p,
                pgp_keyid (k), a->addr));
-      if (!*p || mutt_strcasecmp (p, pgp_keyid (k)) == 0
-          || (!mutt_strncasecmp (p, "0x", 2)
-              && !mutt_strcasecmp (p + 2, pgp_keyid (k)))
-          || (option (OPTPGPLONGIDS) && !mutt_strncasecmp (p, "0x", 2)
-              && !mutt_strcasecmp (p + 2, k->keyid + 8))
-          || mutt_stristr (a->addr, p)) {
+      if (!*p || safe_strcasecmp (p, pgp_keyid (k)) == 0
+          || (!safe_strncasecmp (p, "0x", 2)
+              && !safe_strcasecmp (p + 2, pgp_keyid (k)))
+          || (option (OPTPGPLONGIDS) && !safe_strncasecmp (p, "0x", 2)
+              && !safe_strcasecmp (p + 2, k->keyid + 8))
+          || str_isstr (a->addr, p)) {
         dprint (5, (debugfile, "match.\n"));
         match = 1;
         break;
index 44f8c18..0fc65c0 100644 (file)
@@ -104,7 +104,7 @@ static void pgp_dearmor (FILE * in, FILE * out)
     return;
   }
 
-  if ((end = ftell (in) - mutt_strlen (line)) < start) {
+  if ((end = ftell (in) - safe_strlen (line)) < start) {
     dprint (1, (debugfile, "pgp_dearmor: end < start???\n"));
     return;
   }
index 577db1a..e5f729e 100644 (file)
@@ -710,7 +710,7 @@ static int pgpring_string_matches_hint (const char *s, const char *hints[],
     return 1;
 
   for (i = 0; i < nhints; i++) {
-    if (mutt_stristr (s, hints[i]) != NULL)
+    if (str_isstr (s, hints[i]) != NULL)
       return 1;
   }
 
@@ -743,7 +743,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[],
     char *error_buf;
     size_t error_buf_len;
 
-    error_buf_len = sizeof ("fopen: ") - 1 + mutt_strlen (ringfile) + 1;
+    error_buf_len = sizeof ("fopen: ") - 1 + safe_strlen (ringfile) + 1;
     error_buf = safe_malloc (error_buf_len);
     snprintf (error_buf, error_buf_len, "fopen: %s", ringfile);
     perror (error_buf);
index b2edb96..c67cd7e 100644 (file)
--- a/pop/pop.c
+++ b/pop/pop.c
@@ -124,7 +124,7 @@ static int fetch_uidl (char *line, void *data)
 
   sscanf (line, "%d %s", &index, line);
   for (i = 0; i < ctx->msgcount; i++)
-    if (!mutt_strcmp (line, ctx->hdrs[i]->data))
+    if (!safe_strcmp (line, ctx->hdrs[i]->data))
       break;
 
   if (i == ctx->msgcount) {
index 7499816..df6de73 100644 (file)
@@ -106,11 +106,11 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
       break;
 
 #ifdef USE_SASL2
-    if (!mutt_strncmp (inbuf, "+ ", 2)
+    if (!safe_strncmp (inbuf, "+ ", 2)
         && sasl_decode64 (inbuf, strlen (inbuf), buf, LONG_STRING - 1,
                           &len) != SASL_OK)
 #else
-    if (!mutt_strncmp (inbuf, "+ ", 2)
+    if (!safe_strncmp (inbuf, "+ ", 2)
         && sasl_decode64 (inbuf, strlen (inbuf), buf, &len) != SASL_OK)
 #endif
     {
@@ -153,7 +153,7 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
   if (rc != SASL_OK)
     goto bail;
 
-  if (!mutt_strncmp (inbuf, "+OK", 3)) {
+  if (!safe_strncmp (inbuf, "+OK", 3)) {
     mutt_sasl_setup_conn (pop_data->conn, saslconn);
     return POP_A_SUCCESS;
   }
@@ -162,7 +162,7 @@ bail:
   sasl_dispose (&saslconn);
 
   /* terminate SASL sessoin if the last responce is not +OK nor -ERR */
-  if (!mutt_strncmp (inbuf, "+ ", 2)) {
+  if (!safe_strncmp (inbuf, "+ ", 2)) {
     snprintf (buf, sizeof (buf), "*\r\n");
     if (pop_query (pop_data, buf, sizeof (buf)) == PQ_NOT_CONNECTED)
       return POP_A_SOCKET;
index b17cb25..1b4e267 100644 (file)
@@ -63,7 +63,7 @@ void pop_error (POP_DATA * pop_data, char *msg)
   t = strchr (pop_data->err_msg, '\0');
   c = msg;
 
-  if (!mutt_strncmp (msg, "-ERR ", 5)) {
+  if (!safe_strncmp (msg, "-ERR ", 5)) {
     c2 = msg + 5;
     SKIPWS (c2);
 
@@ -219,7 +219,7 @@ pop_query_status pop_connect (POP_DATA * pop_data)
 
   pop_data->status = POP_CONNECTED;
 
-  if (mutt_strncmp (buf, "+OK", 3)) {
+  if (safe_strncmp (buf, "+OK", 3)) {
     *pop_data->err_msg = '\0';
     pop_error (pop_data, buf);
     mutt_error ("%s", pop_data->err_msg);
@@ -402,7 +402,7 @@ pop_query_status pop_query_d (POP_DATA * pop_data, char *buf, size_t buflen, cha
     pop_data->status = POP_DISCONNECTED;
     return PQ_NOT_CONNECTED;
   }
-  if (!mutt_strncmp (buf, "+OK", 3))
+  if (!safe_strncmp (buf, "+OK", 3))
     return PQ_OK;
 
   pop_error (pop_data, buf);
@@ -482,7 +482,7 @@ static int check_uidl (char *line, void *data)
 
   sscanf (line, "%u %s", &index, line);
   for (i = 0; i < ctx->msgcount; i++) {
-    if (!mutt_strcmp (ctx->hdrs[i]->data, line)) {
+    if (!safe_strcmp (ctx->hdrs[i]->data, line)) {
       ctx->hdrs[i]->refno = index;
       break;
     }
index 30fb2cf..db84a32 100644 (file)
@@ -332,10 +332,10 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
       tmp = next;
     }
     else if ((WithCrypto & APPLICATION_PGP)
-             && (mutt_strncmp ("Pgp:", tmp->data, 4) == 0       /* this is generated
+             && (safe_strncmp ("Pgp:", tmp->data, 4) == 0       /* this is generated
                                                                  * by old mutt versions
                                                                  */
-                 || mutt_strncmp ("X-Mutt-PGP:", tmp->data, 11) == 0)) {
+                 || safe_strncmp ("X-Mutt-PGP:", tmp->data, 11) == 0)) {
       hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1);
       hdr->security |= APPLICATION_PGP;
 
@@ -350,7 +350,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
       tmp = next;
     }
     else if ((WithCrypto & APPLICATION_SMIME)
-             && mutt_strncmp ("X-Mutt-SMIME:", tmp->data, 13) == 0) {
+             && safe_strncmp ("X-Mutt-SMIME:", tmp->data, 13) == 0) {
       hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1);
       hdr->security |= APPLICATION_SMIME;
 
@@ -366,7 +366,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
     }
 
 #ifdef MIXMASTER
-    else if (mutt_strncmp ("X-Mutt-Mix:", tmp->data, 11) == 0) {
+    else if (safe_strncmp ("X-Mutt-Mix:", tmp->data, 11) == 0) {
       char *t;
 
       mutt_free_list (&hdr->chain);
@@ -489,10 +489,10 @@ int mutt_parse_crypt_hdr (char *p, int set_signas)
 
   /* the cryptalg field must not be empty */
   if ((WithCrypto & APPLICATION_SMIME) && *smime_cryptalg)
-    mutt_str_replace (&SmimeCryptAlg, smime_cryptalg);
+    str_replace (&SmimeCryptAlg, smime_cryptalg);
 
   if ((WithCrypto & APPLICATION_PGP) && (set_signas || *pgp_sign_as))
-    mutt_str_replace (&PgpSignAs, pgp_sign_as);
+    str_replace (&PgpSignAs, pgp_sign_as);
 
   return pgp;
 }
@@ -646,7 +646,7 @@ int mutt_prepare_template (FILE * fp, CONTEXT * ctx, HEADER * newhdr,
       newhdr->security |= mutt_is_application_pgp (newhdr->content);
 
       b->type = TYPETEXT;
-      mutt_str_replace (&b->subtype, "plain");
+      str_replace (&b->subtype, "plain");
       mutt_delete_parameter ("x-action", &b->parameter);
     }
     else
@@ -655,7 +655,7 @@ int mutt_prepare_template (FILE * fp, CONTEXT * ctx, HEADER * newhdr,
     if (safe_fclose (&s.fpout) != 0)
       goto bail;
 
-    mutt_str_replace (&b->filename, file);
+    str_replace (&b->filename, file);
     b->unlink = 1;
 
     mutt_stamp_attachment (b);
diff --git a/query.c b/query.c
index c3e948d..9390bcf 100644 (file)
--- a/query.c
+++ b/query.c
@@ -189,7 +189,7 @@ static void query_entry (char *s, size_t slen, MUTTMENU * m, int num)
   mutt_format_string (buf2, sizeof (buf2),
                       FirstColumn + 2, FirstColumn + 2,
                       0, ' ', table[num].data->name,
-                      mutt_strlen (table[num].data->name), 0);
+                      safe_strlen (table[num].data->name), 0);
 
   snprintf (s, slen, " %c %3d %s %-*.*s %s",
             table[num].tagged ? '*' : ' ',
@@ -448,7 +448,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             mutt_addrlist_to_local (tmpa);
             tagged = 1;
             rfc822_write_address (buf, buflen, tmpa, 0);
-            curpos = mutt_strlen (buf);
+            curpos = safe_strlen (buf);
             rfc822_free_address (&tmpa);
           }
           else if (curpos + 2 < buflen) {
@@ -458,7 +458,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
             strcat (buf, ", "); /* __STRCAT_CHECKED__ */
             rfc822_write_address ((char *) buf + curpos + 1,
                                   buflen - curpos - 1, tmpa, 0);
-            curpos = mutt_strlen (buf);
+            curpos = safe_strlen (buf);
             rfc822_free_address (&tmpa);
           }
         }
index 1032a0c..53383bd 100644 (file)
@@ -96,8 +96,8 @@ void mutt_update_tree (ATTACHPTR ** idx, short idxlen)
     }
 
     if (idx[x]->tree) {
-      if (mutt_strcmp (idx[x]->tree, buf) != 0)
-        mutt_str_replace (&idx[x]->tree, buf);
+      if (safe_strcmp (idx[x]->tree, buf) != 0)
+        str_replace (&idx[x]->tree, buf);
     }
     else
       idx[x]->tree = safe_strdup (buf);
@@ -1176,7 +1176,7 @@ void mutt_view_attachments (HEADER * hdr)
       CHECK_ATTACH;
 
       if (!idx[menu->current]->content->hdr->env->followup_to ||
-          mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to,
+          safe_strcasecmp (idx[menu->current]->content->hdr->env->followup_to,
                            "poster")
           || query_quadoption (OPT_FOLLOWUPTOPOSTER,
                                _("Reply by mail as poster prefers?")) !=
index f9f2268..9c6c844 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -684,7 +684,7 @@ attach_reply_envelope_defaults (ENVELOPE * env, ATTACHPTR ** idx,
   if ((flags & SENDNEWS)) {
     /* in case followup set Newsgroups: with Followup-To: if it present */
     if (!env->newsgroups && curenv &&
-        mutt_strcasecmp (curenv->followup_to, "poster"))
+        safe_strcasecmp (curenv->followup_to, "poster"))
       env->newsgroups = safe_strdup (curenv->followup_to);
   }
   else
index 68de837..3239993 100644 (file)
@@ -234,7 +234,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list,
 
   if (i) {
     c =
-      coords[i - 1].c + mutt_strlen (type2_list[chain->ch[i - 1]]->shortname) + 2;
+      coords[i - 1].c + safe_strlen (type2_list[chain->ch[i - 1]]->shortname) + 2;
     r = coords[i - 1].r;
   }
   else {
@@ -245,7 +245,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list,
 
   for (; i < chain->cl; i++) {
     oc = c;
-    c += mutt_strlen (type2_list[chain->ch[i]]->shortname) + 2;
+    c += safe_strlen (type2_list[chain->ch[i]]->shortname) + 2;
 
     if (c >= COLS) {
       oc = c = MIX_HOFFSET;
@@ -431,7 +431,7 @@ static int mix_chain_add (MIXCHAIN * chain, const char *s,
   if (chain->cl >= MAXMIXES)
     return -1;
 
-  if (!mutt_strcmp (s, "0") || !ascii_strcasecmp (s, "<random>")) {
+  if (!safe_strcmp (s, "0") || !ascii_strcasecmp (s, "<random>")) {
     chain->ch[chain->cl++] = 0;
     return 0;
   }
index 31750b5..5466a75 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -139,7 +139,7 @@ static int get_field_text (char *field, char **entry,
     if (entry) {
       field++;
       field = mutt_skip_whitespace (field);
-      mutt_str_replace (entry, field);
+      str_replace (entry, field);
     }
     return 1;
   }
@@ -193,7 +193,7 @@ static int rfc1524_mailcap_parse (BODY * a,
       /* check type */
       ch = get_field (buf);
       if (ascii_strcasecmp (buf, type) && (ascii_strncasecmp (buf, type, btlen) || (buf[btlen] != 0 &&  /* implicit wild */
-                                                                                    mutt_strcmp (buf + btlen, "/*"))))  /* wildsubtype */
+                                                                                    safe_strcmp (buf + btlen, "/*"))))  /* wildsubtype */
         continue;
 
       /* next field is the viewcommand */
@@ -264,7 +264,7 @@ static int rfc1524_mailcap_parse (BODY * a,
 
           if (get_field_text (field + 4, &test_command, type, filename, line)
               && test_command) {
-            len = mutt_strlen (test_command) + STRING;
+            len = safe_strlen (test_command) + STRING;
             safe_realloc (&test_command, len);
             rfc1524_expand_command (a, a->filename, type, test_command, len);
             if (mutt_system (test_command)) {
@@ -472,8 +472,8 @@ int rfc1524_expand_filename (char *nametemplate,
 
       rmatch = 1;
 
-      for (r = 0, j = mutt_strlen (oldfile) - 1, k =
-           mutt_strlen (nametemplate) - 1;
+      for (r = 0, j = safe_strlen (oldfile) - 1, k =
+           safe_strlen (nametemplate) - 1;
            j >= (lmatch ? i : 0) && k >= i + 2; j--, k--) {
         if (nametemplate[k] != oldfile[j]) {
           rmatch = 0;
index b77b60b..596b327 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -36,7 +36,7 @@
 #endif
 
 #define ENCWORD_LEN_MAX 75
-#define ENCWORD_LEN_MIN 9       /* mutt_strlen ("=?.?.?.?=") */
+#define ENCWORD_LEN_MIN 9       /* safe_strlen ("=?.?.?.?=") */
 
 #define HSPACE(x) ((x) == '\0' || (x) == ' ' || (x) == '\t')
 
@@ -94,7 +94,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets,
 
     q = strchr (p, ':');
 
-    n = q ? q - p : mutt_strlen (p);
+    n = q ? q - p : safe_strlen (p);
 
     if (!n ||
         /* Assume that we never need more than 12 characters of
@@ -136,7 +136,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets,
       *dlen = elen;
 
     mutt_canonical_charset (canonical_buff, sizeof (canonical_buff), tocode);
-    mutt_str_replace (&tocode, canonical_buff);
+    str_replace (&tocode, canonical_buff);
   }
   return tocode;
 }
@@ -147,7 +147,7 @@ static size_t b_encoder (char *s, ICONV_CONST char *d, size_t dlen,
   char *s0 = s;
 
   memcpy (s, "=?", 2), s += 2;
-  memcpy (s, tocode, mutt_strlen (tocode)), s += mutt_strlen (tocode);
+  memcpy (s, tocode, safe_strlen (tocode)), s += safe_strlen (tocode);
   memcpy (s, "?B?", 3), s += 3;
   for (;;) {
     if (!dlen)
@@ -185,7 +185,7 @@ static size_t q_encoder (char *s, ICONV_CONST char *d, size_t dlen,
   char *s0 = s;
 
   memcpy (s, "=?", 2), s += 2;
-  memcpy (s, tocode, mutt_strlen (tocode)), s += mutt_strlen (tocode);
+  memcpy (s, tocode, safe_strlen (tocode)), s += safe_strlen (tocode);
   memcpy (s, "?Q?", 3), s += 3;
   while (dlen--) {
     unsigned char c = *d++;
@@ -227,7 +227,7 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen,
   if (fromcode) {
     cd = mutt_iconv_open (tocode, fromcode, 0);
     assert (cd != (iconv_t) (-1));
-    ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - mutt_strlen (tocode);
+    ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - safe_strlen (tocode);
     if (iconv (cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) ||
         iconv (cd, 0, 0, &ob, &obl) == (size_t) (-1)) {
       assert (errno == E2BIG);
@@ -238,8 +238,8 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen,
     iconv_close (cd);
   }
   else {
-    if (dlen > sizeof (buf1) - mutt_strlen (tocode))
-      return sizeof (buf1) - mutt_strlen (tocode) + 1;
+    if (dlen > sizeof (buf1) - safe_strlen (tocode))
+      return sizeof (buf1) - safe_strlen (tocode) + 1;
     memcpy (buf1, d, dlen);
     ob = buf1 + dlen;
   }
@@ -254,7 +254,7 @@ static size_t try_block (ICONV_CONST char *d, size_t dlen,
       ++count;
   }
 
-  len = ENCWORD_LEN_MIN - 2 + mutt_strlen (tocode);
+  len = ENCWORD_LEN_MIN - 2 + safe_strlen (tocode);
   len_b = len + (((ob - buf1) + 2) / 3) * 4;
   len_q = len + (ob - buf1) + 2 * count;
 
@@ -293,7 +293,7 @@ static size_t encode_block (char *s, char *d, size_t dlen,
   if (fromcode) {
     cd = mutt_iconv_open (tocode, fromcode, 0);
     assert (cd != (iconv_t) (-1));
-    ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - mutt_strlen (tocode);
+    ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - safe_strlen (tocode);
     n1 = iconv (cd, &ib, &ibl, &ob, &obl);
     n2 = iconv (cd, 0, 0, &ob, &obl);
     assert (n1 != (size_t) (-1) && n2 != (size_t) (-1));
@@ -480,15 +480,15 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col,
 
     /* Add to output buffer. */
 #define LINEBREAK "\n\t"
-    if (bufpos + wlen + mutt_strlen (LINEBREAK) > buflen) {
-      buflen = bufpos + wlen + mutt_strlen (LINEBREAK);
+    if (bufpos + wlen + safe_strlen (LINEBREAK) > buflen) {
+      buflen = bufpos + wlen + safe_strlen (LINEBREAK);
       safe_realloc (&buf, buflen);
     }
     r = encode_block (buf + bufpos, t, n, icode, tocode, encoder);
     assert (r == wlen);
     bufpos += wlen;
-    memcpy (buf + bufpos, LINEBREAK, mutt_strlen (LINEBREAK));
-    bufpos += mutt_strlen (LINEBREAK);
+    memcpy (buf + bufpos, LINEBREAK, safe_strlen (LINEBREAK));
+    bufpos += safe_strlen (LINEBREAK);
 #undef LINEBREAK
 
     col = 1;
@@ -527,7 +527,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col)
   if (!charsets || !*charsets)
     charsets = "UTF-8";
 
-  rfc2047_encode (*pd, mutt_strlen (*pd), col,
+  rfc2047_encode (*pd, safe_strlen (*pd), col,
                   Charset, charsets, &e, &elen,
                   encode_specials ? RFC822Specials : NULL);
 
@@ -538,7 +538,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col)
 void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag)
 {
   ADDRESS *ptr = addr;
-  int col = tag ? mutt_strlen (tag) + 2 : 32;
+  int col = tag ? safe_strlen (tag) + 2 : 32;
 
   while (ptr) {
     if (ptr->personal)
@@ -559,7 +559,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len)
   int enc = 0, count = 0;
   char *charset = NULL;
 
-  pd = d0 = safe_malloc (mutt_strlen (s));
+  pd = d0 = safe_malloc (safe_strlen (s));
 
   for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) {
     count++;
@@ -715,14 +715,14 @@ void rfc2047_decode (char **pd)
   if (!s || !*s)
     return;
 
-  dlen = 4 * mutt_strlen (s);        /* should be enough */
+  dlen = 4 * safe_strlen (s);        /* should be enough */
   d = d0 = safe_malloc (dlen + 1);
 
   while (*s && dlen > 0) {
     if (!(p = find_encoded_word (s, &q))) {
       /* no encoded words */
       if (!option (OPTSTRICTMIME)) {
-        n = mutt_strlen (s);
+        n = safe_strlen (s);
         if (found_encoded && (m = lwslen (s, n)) != 0) {
           if (m != n)
             *d = ' ', d++, dlen--;
@@ -735,7 +735,7 @@ void rfc2047_decode (char **pd)
           t = safe_malloc (n + 1);
           strfcpy (t, s, n + 1);
           if (mutt_convert_nonmime_string (&t) == 0) {
-            tlen = mutt_strlen (t);
+            tlen = safe_strlen (t);
             strncpy (d, t, tlen);
             d += tlen;
           }
@@ -785,7 +785,7 @@ void rfc2047_decode (char **pd)
     rfc2047_decode_word (d, p, dlen);
     found_encoded = 1;
     s = q;
-    n = mutt_strlen (d);
+    n = safe_strlen (d);
     dlen -= n;
     d += n;
   }
@@ -793,7 +793,7 @@ void rfc2047_decode (char **pd)
 
   FREE (pd);
   *pd = d0;
-  mutt_str_adjust (pd);
+  str_adjust (pd);
 }
 
 void rfc2047_decode_adrlist (ADDRESS * a)
index 0fcc857..3c0f097 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -230,7 +230,7 @@ static void rfc2231_list_insert (struct rfc2231_parameter **list,
     q = p;
     p = p->next;
 
-    c = mutt_strcmp (par->value, q->value);
+    c = safe_strcmp (par->value, q->value);
     if ((c > 0) || (c == 0 && par->index >= q->index))
       break;
   }
@@ -269,7 +269,7 @@ static void rfc2231_join_continuations (PARAMETER ** head,
       if (encoded && par->encoded)
         rfc2231_decode_one (par->value, valp);
 
-      vl = mutt_strlen (par->value);
+      vl = safe_strlen (par->value);
 
       safe_realloc (&value, l + vl + 1);
       strcpy (value + l, par->value);   /* __STRCPY_CHECKED__ */
@@ -279,7 +279,7 @@ static void rfc2231_join_continuations (PARAMETER ** head,
       rfc2231_free_parameter (&par);
       if ((par = q))
         valp = par->value;
-    } while (par && !mutt_strcmp (par->attribute, attribute));
+    } while (par && !safe_strcmp (par->attribute, attribute));
 
     if (value) {
       if (encoded)
@@ -314,10 +314,10 @@ int rfc2231_encode_string (char **pd)
 
   if (!Charset || !SendCharset ||
       !(charset = mutt_choose_charset (Charset, SendCharset,
-                                       *pd, mutt_strlen (*pd), &d, &dlen))) {
+                                       *pd, safe_strlen (*pd), &d, &dlen))) {
     charset = safe_strdup (Charset ? Charset : "unknown-8bit");
     d = *pd;
-    dlen = mutt_strlen (d);
+    dlen = safe_strlen (d);
   }
 
   if (!mutt_is_us_ascii (charset))
@@ -330,9 +330,9 @@ int rfc2231_encode_string (char **pd)
       ++ext;
 
   if (encode) {
-    e = safe_malloc (dlen + 2 * ext + mutt_strlen (charset) + 3);
+    e = safe_malloc (dlen + 2 * ext + safe_strlen (charset) + 3);
     sprintf (e, "%s''", charset);       /* __SPRINTF_CHECKED__ */
-    t = e + mutt_strlen (e);
+    t = e + safe_strlen (e);
     for (s = d, slen = dlen; slen; s++, slen--)
       if (*s < 0x20 || *s >= 0x7f ||
           strchr (MimeSpecials, *s) || strchr ("*'%", *s)) {
index f1c86e9..5f20de4 100644 (file)
--- a/rfc822.c
+++ b/rfc822.c
@@ -330,7 +330,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
 
 #ifdef EXACT_ADDRESS
       if (last && !last->val)
-        last->val = mutt_substrdup (begin, s);
+        last->val = str_substrdup (begin, s);
 #endif
       commentlen = 0;
       phraselen = 0;
@@ -362,7 +362,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
       last = cur;
 
 #ifdef EXACT_ADDRESS
-      last->val = mutt_substrdup (begin, s);
+      last->val = str_substrdup (begin, s);
 #endif
 
       phraselen = 0;
@@ -383,7 +383,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
       }
 #ifdef EXACT_ADDRESS
       if (last && !last->val)
-        last->val = mutt_substrdup (begin, s);
+        last->val = str_substrdup (begin, s);
 #endif
 
       /* add group terminator */
@@ -453,7 +453,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
   }
 #ifdef EXACT_ADDRESS
   if (last)
-    last->val = mutt_substrdup (begin, s);
+    last->val = str_substrdup (begin, s);
 #endif
 
   return top;
@@ -465,7 +465,7 @@ void rfc822_qualify (ADDRESS * addr, const char *host)
 
   for (; addr; addr = addr->next)
     if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) {
-      p = safe_malloc (mutt_strlen (addr->mailbox) + mutt_strlen (host) + 2);
+      p = safe_malloc (safe_strlen (addr->mailbox) + safe_strlen (host) + 2);
       sprintf (p, "%s@%s", addr->mailbox, host);        /* __SPRINTF_CHECKED__ */
       FREE (&addr->mailbox);
       addr->mailbox = p;
@@ -513,7 +513,7 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
     if (!buflen)
       goto done;
     strfcpy (pbuf, addr->val, buflen);
-    len = mutt_strlen (pbuf);
+    len = safe_strlen (pbuf);
     pbuf += len;
     buflen -= len;
     if (addr->group) {
@@ -554,7 +554,7 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
       if (!buflen)
         goto done;
       strfcpy (pbuf, addr->personal, buflen);
-      len = mutt_strlen (pbuf);
+      len = safe_strlen (pbuf);
       pbuf += len;
       buflen -= len;
     }
@@ -577,11 +577,11 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
       goto done;
     if (ascii_strcmp (addr->mailbox, "@") && !display) {
       strfcpy (pbuf, addr->mailbox, buflen);
-      len = mutt_strlen (pbuf);
+      len = safe_strlen (pbuf);
     }
     else if (ascii_strcmp (addr->mailbox, "@") && display) {
       strfcpy (pbuf, mutt_addr_for_display (addr), buflen);
-      len = mutt_strlen (pbuf);
+      len = safe_strlen (pbuf);
     }
     else {
       *pbuf = '\0';
@@ -625,7 +625,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr,
                            int display)
 {
   char *pbuf = buf;
-  size_t len = mutt_strlen (buf);
+  size_t len = safe_strlen (buf);
 
   buflen--;                     /* save room for the terminal nul */
 
@@ -652,7 +652,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr,
 
     /* this should be safe since we always have at least 1 char passed into
        the above call, which means `pbuf' should always be nul terminated */
-    len = mutt_strlen (pbuf);
+    len = safe_strlen (pbuf);
     pbuf += len;
     buflen -= len;
 
diff --git a/score.c b/score.c
index fba01f8..40dbd46 100644 (file)
--- a/score.c
+++ b/score.c
@@ -78,7 +78,7 @@ int mutt_parse_score (BUFFER * buf, BUFFER * s, unsigned long data,
   /* look for an existing entry and update the value, else add it to the end
      of the list */
   for (ptr = Score, last = NULL; ptr; last = ptr, ptr = ptr->next)
-    if (mutt_strcmp (pattern, ptr->str) == 0)
+    if (safe_strcmp (pattern, ptr->str) == 0)
       break;
   if (!ptr) {
     if ((pat = mutt_pattern_comp (pattern, 0, err)) == NULL) {
@@ -135,7 +135,7 @@ int mutt_parse_unscore (BUFFER * buf, BUFFER * s, unsigned long data,
 
   while (MoreArgs (s)) {
     mutt_extract_token (buf, s, 0);
-    if (!mutt_strcmp ("*", buf->data)) {
+    if (!safe_strcmp ("*", buf->data)) {
       for (tmp = Score; tmp;) {
         last = tmp;
         tmp = tmp->next;
@@ -146,7 +146,7 @@ int mutt_parse_unscore (BUFFER * buf, BUFFER * s, unsigned long data,
     }
     else {
       for (tmp = Score; tmp; last = tmp, tmp = tmp->next) {
-        if (!mutt_strcmp (buf->data, tmp->str)) {
+        if (!safe_strcmp (buf->data, tmp->str)) {
           if (last)
             last->next = tmp->next;
           else
diff --git a/send.c b/send.c
index e932ee2..22d4c90 100644 (file)
--- a/send.c
+++ b/send.c
@@ -291,7 +291,7 @@ static int edit_envelope (ENVELOPE * en, int flags)
 
     return (-1);
   }
-  mutt_str_replace (&en->subject, buf);
+  str_replace (&en->subject, buf);
 
   return 0;
 }
@@ -346,7 +346,7 @@ static void process_user_header (ENVELOPE * env)
       env->reply_to = rfc822_parse_adrlist (env->reply_to, uh->data + 9);
     }
     else if (ascii_strncasecmp ("message-id:", uh->data, 11) == 0)
-      mutt_str_replace (&env->message_id, uh->data + 11);
+      str_replace (&env->message_id, uh->data + 11);
     else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 &&
              ascii_strncasecmp ("cc:", uh->data, 3) != 0 &&
              ascii_strncasecmp ("bcc:", uh->data, 4) != 0 &&
@@ -649,7 +649,7 @@ void mutt_make_forward_subject (ENVELOPE * env, CONTEXT * ctx, HEADER * cur)
 
   /* set the default subject for the message. */
   mutt_make_string (buffer, sizeof (buffer), NONULL (ForwFmt), ctx, cur);
-  mutt_str_replace (&env->subject, buffer);
+  str_replace (&env->subject, buffer);
 }
 
 void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx,
@@ -660,7 +660,7 @@ void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx,
    */
   if (curenv->real_subj) {
     FREE (&env->subject);
-    env->subject = safe_malloc (mutt_strlen (curenv->real_subj) + 5);
+    env->subject = safe_malloc (safe_strlen (curenv->real_subj) + 5);
     sprintf (env->subject, "Re: %s", curenv->real_subj);        /* __SPRINTF_CHECKED__ */
   }
   else if (!env->subject)
@@ -759,7 +759,7 @@ envelope_defaults (ENVELOPE * env, CONTEXT * ctx, HEADER * cur, int flags)
     if ((flags & SENDNEWS)) {
       /* in case followup set Newsgroups: with Followup-To: if it present */
       if (!env->newsgroups && curenv &&
-          mutt_strcasecmp (curenv->followup_to, "poster"))
+          safe_strcasecmp (curenv->followup_to, "poster"))
         env->newsgroups = safe_strdup (curenv->followup_to);
     }
     else
@@ -996,7 +996,7 @@ ADDRESS *mutt_default_from (void)
   else if (option (OPTUSEDOMAIN)) {
     adr = rfc822_new_address ();
     adr->mailbox =
-      safe_malloc (mutt_strlen (Username) + mutt_strlen (fqdn) + 2);
+      safe_malloc (safe_strlen (Username) + safe_strlen (fqdn) + 2);
     sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn));  /* __SPRINTF_CHECKED__ */
   }
   else {
@@ -1316,7 +1316,7 @@ int ci_send_message (int flags, /* send mode */
 
     if (option (OPTSIGONTOP)
         && (!(flags & (SENDMAILX | SENDKEY)) && Editor
-            && mutt_strcmp (Editor, "builtin") != 0))
+            && safe_strcmp (Editor, "builtin") != 0))
       append_signature (tempfp);
 
     /* include replies/forwarded messages, unless we are given a template */
@@ -1326,7 +1326,7 @@ int ci_send_message (int flags, /* send mode */
 
     if (!option (OPTSIGONTOP)
         && (!(flags & (SENDMAILX | SENDKEY)) && Editor
-            && mutt_strcmp (Editor, "builtin") != 0))
+            && safe_strcmp (Editor, "builtin") != 0))
       append_signature (tempfp);
 
     /* 
@@ -1439,7 +1439,7 @@ int ci_send_message (int flags, /* send mode */
       /* If the this isn't a text message, look for a mailcap edit command */
       if (mutt_needs_mailcap (msg->content))
         mutt_edit_attachment (msg->content);
-      else if (!Editor || mutt_strcmp ("builtin", Editor) == 0)
+      else if (!Editor || safe_strcmp ("builtin", Editor) == 0)
         mutt_builtin_editor (msg->content->filename, msg, cur);
       else if (option (OPTEDITHDRS)) {
         mutt_env_to_local (msg->env);
@@ -1667,7 +1667,7 @@ int ci_send_message (int flags, /* send mode */
     fcc[0] = '\0';
 #endif
 
-  if (*fcc && mutt_strcmp ("/dev/null", fcc) != 0) {
+  if (*fcc && safe_strcmp ("/dev/null", fcc) != 0) {
     BODY *tmpbody = msg->content;
     BODY *save_sig = NULL;
     BODY *save_parts = NULL;
@@ -1678,8 +1678,8 @@ int ci_send_message (int flags, /* send mode */
     /* check to see if the user wants copies of all attachments */
     if (!option (OPTFCCATTACH) && msg->content->type == TYPEMULTIPART) {
       if (WithCrypto
-          && (mutt_strcmp (msg->content->subtype, "encrypted") == 0 ||
-              mutt_strcmp (msg->content->subtype, "signed") == 0)) {
+          && (safe_strcmp (msg->content->subtype, "encrypted") == 0 ||
+              safe_strcmp (msg->content->subtype, "signed") == 0)) {
         if (clear_content->type == TYPEMULTIPART) {
           if (!(msg->security & ENCRYPT) && (msg->security & SIGN)) {
             /* save initial signature and attachments */
index d5a6093..1290fd9 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -187,11 +187,11 @@ static void encode_quoted (FGETCONV * fc, FILE * fout, int istext)
     }
 
     /* Escape lines that begin with/only contain "the message separator". */
-    if (linelen == 4 && !mutt_strncmp ("From", line, 4)) {
+    if (linelen == 4 && !safe_strncmp ("From", line, 4)) {
       strfcpy (line, "=46rom", sizeof (line));
       linelen = 6;
     }
-    else if (linelen == 4 && !mutt_strncmp ("from", line, 4)) {
+    else if (linelen == 4 && !safe_strncmp ("from", line, 4)) {
       strfcpy (line, "=66rom", sizeof (line));
       linelen = 6;
     }
@@ -362,7 +362,7 @@ int mutt_write_mime_header (BODY * a, FILE * f)
   fprintf (f, "Content-Type: %s/%s", TYPE (a), a->subtype);
 
   if (a->parameter) {
-    len = 25 + mutt_strlen (a->subtype);        /* approximate len. of content-type */
+    len = 25 + safe_strlen (a->subtype);        /* approximate len. of content-type */
 
     for (p = a->parameter; p; p = p->next) {
       char *tmp;
@@ -388,7 +388,7 @@ int mutt_write_mime_header (BODY * a, FILE * f)
 
       FREE (&tmp);
 
-      tmplen = mutt_strlen (buffer) + mutt_strlen (p->attribute) + 1;
+      tmplen = safe_strlen (buffer) + safe_strlen (p->attribute) + 1;
 
       if (len + tmplen + 2 > 76) {
         fputs ("\n\t", f);
@@ -481,7 +481,7 @@ int mutt_write_mime_body (BODY * a, FILE * f)
   /* This is pretty gross, but it's the best solution for now... */
   if ((WithCrypto & APPLICATION_PGP)
       && a->type == TYPEAPPLICATION
-      && mutt_strcmp (a->subtype, "pgp-encrypted") == 0) {
+      && safe_strcmp (a->subtype, "pgp-encrypted") == 0) {
     fputs ("Version: 1\n", f);
     return 0;
   }
@@ -827,7 +827,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;
-    tcode[i] = mutt_substrdup (c, c1);
+    tcode[i] = str_substrdup (c, c1);
   }
 
   ret = (size_t) (-1);
@@ -836,7 +836,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;
-      fcode = mutt_substrdup (c, c1);
+      fcode = str_substrdup (c, c1);
 
       ret = convert_file_to (file, fcode, ncodes, (const char **) tcode,
                              &cn, info);
@@ -963,7 +963,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
   type = TYPEOTHER;
   cur_sze = 0;
 
-  szf = mutt_strlen (path);
+  szf = safe_strlen (path);
 
   for (count = 0; count < 3; count++) {
     /*
@@ -1006,9 +1006,9 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
 
         /* cycle through the file extensions */
         while ((p = strtok (p, " \t\n"))) {
-          sze = mutt_strlen (p);
+          sze = safe_strlen (p);
           if ((sze > cur_sze) && (szf >= sze) &&
-              (mutt_strcasecmp (path + szf - sze, p) == 0
+              (safe_strcasecmp (path + szf - sze, p) == 0
                || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze
                                                                    || path[szf
                                                                            -
@@ -1026,7 +1026,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
 
             for (q = p; *q && !ISSPACE (*q); q++);
 
-            mutt_substrcpy (subtype, p, q, sizeof (subtype));
+            str_substrcpy (subtype, p, q, sizeof (subtype));
 
             if ((type = mutt_check_mime_type (ct)) == TYPEOTHER)
               strfcpy (xtype, ct, sizeof (xtype));
@@ -1044,8 +1044,8 @@ bye:
 
   if (type != TYPEOTHER || *xtype != '\0') {
     att->type = type;
-    mutt_str_replace (&att->subtype, subtype);
-    mutt_str_replace (&att->xtype, xtype);
+    str_replace (&att->subtype, subtype);
+    str_replace (&att->xtype, xtype);
   }
 
   return (type);
@@ -1473,7 +1473,7 @@ void mutt_write_address_list (ADDRESS * adr, FILE * fp, int linelen,
     adr->next = NULL;
     buf[0] = 0;
     rfc822_write_address (buf, sizeof (buf), adr, display);
-    len = mutt_strlen (buf);
+    len = safe_strlen (buf);
     if (count && linelen + len > 74) {
       fputs ("\n\t", fp);
       linelen = len + 8;        /* tab is usually about 8 spaces... */
@@ -1717,7 +1717,7 @@ static void encode_headers (LIST * h)
 
     rfc2047_encode_string (&tmp);
     safe_realloc (&h->data,
-                  mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1);
+                  safe_strlen (h->data) + 2 + safe_strlen (tmp) + 1);
 
     sprintf (h->data + i, ": %s", NONULL (tmp));        /* __SPRINTF_CHECKED__ */
 
@@ -1791,11 +1791,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt)
         break;
       case 'O':
         snprintf (tmp, sizeof (tmp), "%lo", (unsigned long) now);
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        safe_strncat (buf, len, tmp, safe_strlen (tmp));
         break;
       case 'p':
         snprintf (tmp, sizeof (tmp), "%u", (unsigned int) getpid ());
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        safe_strncat (buf, len, tmp, safe_strlen (tmp));
         break;
       case 'P':
         snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx);
@@ -1804,11 +1804,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt)
         break;
       case 'r':
         snprintf (tmp, sizeof (tmp), "%u", (unsigned int) rand ());
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        safe_strncat (buf, len, tmp, safe_strlen (tmp));
         break;
       case 'R':
         snprintf (tmp, sizeof (tmp), "%x", (unsigned int) rand ());
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        safe_strncat (buf, len, tmp, safe_strlen (tmp));
         break;
       case 's':
         snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec);
@@ -1816,11 +1816,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt)
         break;
       case 'T':
         snprintf (tmp, sizeof (tmp), "%u", (unsigned int) now);
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        safe_strncat (buf, len, tmp, safe_strlen (tmp));
         break;
       case 'X':
         snprintf (tmp, sizeof (tmp), "%x", (unsigned int) now);
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        safe_strncat (buf, len, tmp, safe_strlen (tmp));
         break;
       case 'Y':
         snprintf (tmp, sizeof (tmp), "%04d", tm->tm_year + 1900);       /* this will break in the year 10000 ;-) */
@@ -1857,7 +1857,7 @@ char *mutt_gen_msgid (void)
   if (!(fqdn = mutt_fqdn (0)))
     fqdn = NONULL (Hostname);
 
-  localpart_length = sizeof (buf) - mutt_strlen (fqdn) - 4;  /* the 4 characters are '<', '@', '>' and '\0' */
+  localpart_length = sizeof (buf) - safe_strlen (fqdn) - 4;  /* the 4 characters are '<', '@', '>' and '\0' */
 
   mutt_gen_localpart (localpart, localpart_length, MsgIdFormat);
 
@@ -2182,9 +2182,9 @@ int mutt_invoke_mta (ADDRESS * from,    /* the sender */
    string. */
 char *mutt_append_string (char *a, const char *b)
 {
-  size_t la = mutt_strlen (a);
+  size_t la = safe_strlen (a);
 
-  safe_realloc (&a, la + mutt_strlen (b) + 1);
+  safe_realloc (&a, la + safe_strlen (b) + 1);
   strcpy (a + la, b);           /* __STRCPY_CHECKED__ */
   return (a);
 }
@@ -2212,7 +2212,7 @@ char *mutt_quote_string (const char *s)
   char *r, *pr;
   size_t rlen;
 
-  rlen = mutt_strlen (s) + 3;
+  rlen = safe_strlen (s) + 3;
   pr = r = (char *) safe_malloc (rlen);
   *pr++ = '"';
   while (*s) {
index c352913..40a0fee 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -67,7 +67,7 @@ static char *shortened_hierarchy (char *box)
   int i, j;
   char *new_box;
 
-  for (i = 0; i < mutt_strlen (box); ++i) {
+  for (i = 0; i < safe_strlen (box); ++i) {
     if (box[i] == '.')
       ++dots;
     else if (isupper (box[i]))
@@ -76,9 +76,9 @@ static char *shortened_hierarchy (char *box)
   last_dot = strrchr (box, '.');
   if (last_dot) {
     ++last_dot;
-    new_box = safe_malloc (mutt_strlen (last_dot) + 2 * dots + 1);
+    new_box = safe_malloc (safe_strlen (last_dot) + 2 * dots + 1);
     new_box[0] = box[0];
-    for (i = 1, j = 1; i < mutt_strlen (box); ++i) {
+    for (i = 1, j = 1; i < safe_strlen (box); ++i) {
       if (box[i] == '.') {
         new_box[j++] = '.';
         new_box[j] = 0;
@@ -108,17 +108,17 @@ char *make_sidebar_entry (char *box, int size, int new, int flagged)
   if (SidebarWidth > COLS)
     SidebarWidth = COLS;
 
-  dlen = mutt_strlen (SidebarDelim);
+  dlen = safe_strlen (SidebarDelim);
   max = SidebarWidth - dlen - 1;
 
   safe_realloc (&entry, SidebarWidth + 1);
   entry[SidebarWidth] = 0;
   for (; i < SidebarWidth; entry[i++] = ' ');
 #if USE_IMAP
-  if (ImapHomeNamespace && mutt_strlen (ImapHomeNamespace) > 0) {
-    if (strncmp (box, ImapHomeNamespace, mutt_strlen (ImapHomeNamespace)) == 0
-        && mutt_strcmp (box, ImapHomeNamespace) != 0) {
-      box += mutt_strlen (ImapHomeNamespace) + 1;
+  if (ImapHomeNamespace && safe_strlen (ImapHomeNamespace) > 0) {
+    if (strncmp (box, ImapHomeNamespace, safe_strlen (ImapHomeNamespace)) == 0
+        && safe_strcmp (box, ImapHomeNamespace) != 0) {
+      box += safe_strlen (ImapHomeNamespace) + 1;
     }
   }
 #endif
@@ -127,11 +127,11 @@ char *make_sidebar_entry (char *box, int size, int new, int flagged)
     max -= quick_log10 (new) + 2;
   if (flagged > 0)
     max -= quick_log10 (flagged) + 2;
-  if (option (OPTSHORTENHIERARCHY) && mutt_strlen (box) > max) {
+  if (option (OPTSHORTENHIERARCHY) && safe_strlen (box) > max) {
     box = shortened_hierarchy (box);
     shortened = 1;
   }
-  i = mutt_strlen (box);
+  i = safe_strlen (box);
   strncpy (entry, box, i < SidebarWidth - dlen ? i : SidebarWidth - dlen);
 
   if (new) {
@@ -218,7 +218,7 @@ int sidebar_draw (int menu)
   int lines = option (OPTHELP) ? 1 : 0;
   BUFFY *tmp;
   int i = 0;
-  short delim_len = mutt_strlen (SidebarDelim);
+  short delim_len = safe_strlen (SidebarDelim);
 
   /* initialize first time */
   if (!initialized) {
@@ -244,7 +244,7 @@ int sidebar_draw (int menu)
   }
 
   if (SidebarWidth > 0 && option (OPTMBOXPANE)
-      && mutt_strlen (SidebarDelim) >= SidebarWidth) {
+      && safe_strlen (SidebarDelim) >= SidebarWidth) {
     mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
     sleep (2);
     unset_option (OPTMBOXPANE);
@@ -262,9 +262,9 @@ int sidebar_draw (int menu)
     move (lines, SidebarWidth - delim_len);
     if (option (OPTASCIICHARS))
       addstr (NONULL (SidebarDelim));
-    else if (!option (OPTASCIICHARS) && !mutt_strcmp (SidebarDelim, "|"))
+    else if (!option (OPTASCIICHARS) && !safe_strcmp (SidebarDelim, "|"))
       addch (ACS_VLINE);
-    else if ((Charset_is_utf8) && !mutt_strcmp (SidebarDelim, "|"))
+    else if ((Charset_is_utf8) && !safe_strcmp (SidebarDelim, "|"))
       addstr ("\342\224\202");
     else
       addstr (NONULL (SidebarDelim));
@@ -293,7 +293,7 @@ int sidebar_draw (int menu)
     move (lines, 0);
     if (option (OPTSIDEBARNEWMAILONLY)) {
       if (tmp->msg_unread > 0) {
-        if (Context && !mutt_strcmp (tmp->path, Context->path)) {
+        if (Context && !safe_strcmp (tmp->path, Context->path)) {
           printw ("%.*s", SidebarWidth - delim_len,
                   make_sidebar_entry (basename (tmp->path),
                                       Context->msgcount, Context->unread,
@@ -311,7 +311,7 @@ int sidebar_draw (int menu)
       }
     }
     else {
-      if (Context && !mutt_strcmp (tmp->path, Context->path)) {
+      if (Context && !safe_strcmp (tmp->path, Context->path)) {
         printw ("%.*s", SidebarWidth - delim_len,
                 make_sidebar_entry (basename (tmp->path),
                                     Context->msgcount, Context->unread,
diff --git a/smime.c b/smime.c
index 2e39a26..6f5c0f2 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -403,7 +403,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
         continue;
 
       /* Check if query matches this certificate */
-      if (!mutt_stristr (fields[0], qry) && !mutt_stristr (fields[2], qry))
+      if (!str_isstr (fields[0], qry) && !str_isstr (fields[2], qry))
         continue;
 
       Table[cur].hash = hash;
@@ -488,8 +488,8 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
   if (!mailbox && !query)
     return (NULL);
 
-  addr_len = mailbox ? mutt_strlen (mailbox) : 0;
-  query_len = query ? mutt_strlen (query) : 0;
+  addr_len = mailbox ? safe_strlen (mailbox) : 0;
+  query_len = query ? safe_strlen (query) : 0;
 
   *key = '\0';
 
@@ -511,7 +511,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
     }
 
     while (fgets (buf, sizeof (buf) - 1, fp) != NULL)
-      if (mailbox && !(mutt_strncasecmp (mailbox, buf, addr_len))) {
+      if (mailbox && !(safe_strncasecmp (mailbox, buf, addr_len))) {
         numFields = sscanf (buf,
                             MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " "
                             MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " "
@@ -573,13 +573,13 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
 
         /* query = label: return certificate. */
         if (numFields >= 3 &&
-            !(mutt_strncasecmp (query, fields[2], query_len))) {
+            !(safe_strncasecmp (query, fields[2], query_len))) {
           ask = 0;
           strfcpy (key, fields[1], sizeof (key));
         }
         /* query = certificate: return intermediate certificate. */
         else if (numFields >= 4 &&
-                 !(mutt_strncasecmp (query, fields[1], query_len))) {
+                 !(safe_strncasecmp (query, fields[1], query_len))) {
           ask = 0;
           strfcpy (key, fields[3], sizeof (key));
         }
@@ -648,7 +648,7 @@ void _smime_getkeys (char *mailbox)
   if (k) {
     /* the key used last time. */
     if (*SmimeKeyToUse &&
-        !mutt_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1)) {
+        !safe_strcasecmp (k, SmimeKeyToUse + safe_strlen (SmimeKeys) + 1)) {
       FREE (&k);
       return;
     }
@@ -661,7 +661,7 @@ void _smime_getkeys (char *mailbox)
     snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
               NONULL (SmimeCertificates), k);
 
-    if (mutt_strcasecmp (k, SmimeDefaultKey))
+    if (safe_strcasecmp (k, SmimeDefaultKey))
       smime_void_passphrase ();
 
     FREE (&k);
@@ -669,8 +669,8 @@ void _smime_getkeys (char *mailbox)
   }
 
   if (*SmimeKeyToUse) {
-    if (!mutt_strcasecmp (SmimeDefaultKey,
-                          SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1))
+    if (!safe_strcasecmp (SmimeDefaultKey,
+                          SmimeKeyToUse + safe_strlen (SmimeKeys) + 1))
       return;
 
     smime_void_passphrase ();
@@ -772,10 +772,10 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
       return NULL;
     }
 
-    keylist_size += mutt_strlen (keyID) + 2;
+    keylist_size += safe_strlen (keyID) + 2;
     safe_realloc (&keylist, keylist_size);
     sprintf (keylist + keylist_used, "%s\n", keyID);    /* __SPRINTF_CHECKED__ */
-    keylist_used = mutt_strlen (keylist);
+    keylist_used = safe_strlen (keylist);
 
     rfc822_free_address (&addr);
 
@@ -832,8 +832,8 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
 
 
   while ((fgets (email, sizeof (email), fpout))) {
-    *(email + mutt_strlen (email) - 1) = '\0';
-    if (mutt_strncasecmp (email, mailbox, mutt_strlen (mailbox)) == 0)
+    *(email + safe_strlen (email) - 1) = '\0';
+    if (safe_strncasecmp (email, mailbox, safe_strlen (mailbox)) == 0)
       ret = 1;
 
     ret = ret < 0 ? 0 : ret;
@@ -859,9 +859,9 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
 
     rewind (fpout);
     while ((fgets (email, sizeof (email), fpout))) {
-      *(email + mutt_strlen (email) - 1) = '\0';
-      (*buffer)[count] = safe_calloc (1, mutt_strlen (email) + 1);
-      strncpy ((*buffer)[count], email, mutt_strlen (email));
+      *(email + safe_strlen (email) - 1) = '\0';
+      (*buffer)[count] = safe_calloc (1, safe_strlen (email) + 1);
+      strncpy ((*buffer)[count], email, safe_strlen (email));
       count++;
     }
   }
@@ -1241,7 +1241,7 @@ BODY *smime_build_smime_entity (BODY * a, char *certlist)
 
   *certfile = '\0';
   while (1) {
-    int off = mutt_strlen (certfile);
+    int off = safe_strlen (certfile);
 
     while (*++cert_end && *cert_end != '\n');
     if (!*cert_end)
@@ -1564,7 +1564,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
       rewind (smimeerr);
 
       line = mutt_read_line (line, &linelen, smimeerr, &lineno);
-      if (linelen && !mutt_strcasecmp (line, "verification successful"))
+      if (linelen && !safe_strcasecmp (line, "verification successful"))
         badsig = 0;
 
       FREE (&line);
@@ -1729,7 +1729,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
       }
     }
     while (fgets (buf, sizeof (buf) - 1, smimeout) != NULL) {
-      len = mutt_strlen (buf);
+      len = safe_strlen (buf);
       if (len > 1 && buf[len - 2] == '\r') {
         buf[len - 2] = '\n';
         buf[len - 1] = '\0';
@@ -1780,7 +1780,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
     rewind (smimeerr);
 
     line = mutt_read_line (line, &linelen, smimeerr, &lineno);
-    if (linelen && !mutt_strcasecmp (line, "verification successful"))
+    if (linelen && !safe_strcasecmp (line, "verification successful"))
       m->goodsig = 1;
     FREE (&line);
   }
@@ -1884,19 +1884,19 @@ int smime_send_menu (HEADER * msg, int *redraw)
                                  " 4: RC2-64, 5: RC2-128, or (f)orget it? "),
                                _("12345f"))) {
     case 1:
-      mutt_str_replace (&SmimeCryptAlg, "des");
+      str_replace (&SmimeCryptAlg, "des");
       break;
     case 2:
-      mutt_str_replace (&SmimeCryptAlg, "des3");
+      str_replace (&SmimeCryptAlg, "des3");
       break;
     case 3:
-      mutt_str_replace (&SmimeCryptAlg, "rc2-40");
+      str_replace (&SmimeCryptAlg, "rc2-40");
       break;
     case 4:
-      mutt_str_replace (&SmimeCryptAlg, "rc2-64");
+      str_replace (&SmimeCryptAlg, "rc2-64");
       break;
     case 5:
-      mutt_str_replace (&SmimeCryptAlg, "rc2-128");
+      str_replace (&SmimeCryptAlg, "rc2-128");
       break;
     case 6:                    /* forget it */
       break;
@@ -1917,8 +1917,8 @@ int smime_send_menu (HEADER * msg, int *redraw)
   case 4:                      /* sign (a)s */
 
     if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) {
-      p[mutt_strlen (p) - 1] = '\0';
-      mutt_str_replace (&SmimeDefaultKey, p);
+      p[safe_strlen (p) - 1] = '\0';
+      str_replace (&SmimeDefaultKey, p);
 
       msg->security |= SIGN;
 
index 43366b4..72c3d11 100644 (file)
@@ -401,7 +401,7 @@ static void fmtstr (char *buffer, size_t * currlen, size_t maxlen,
     value = "<NULL>";
   }
 
-  for (strln = 0; value[strln]; ++strln);       /* mutt_strlen */
+  for (strln = 0; value[strln]; ++strln);       /* safe_strlen */
   padlen = min - strln;
   if (padlen < 0)
     padlen = 0;
@@ -688,7 +688,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
 {
   str[0] = 0;
   dopr (str, count, fmt, args);
-  return (mutt_strlen (str));
+  return (safe_strlen (str));
 }
 #endif /* !HAVE_VSNPRINTF */
 
@@ -716,7 +716,7 @@ int snprintf (va_alist)
 
   (void) vsnprintf (str, count, fmt, ap);
   VA_END;
-  return (mutt_strlen (str));
+  return (safe_strlen (str));
 }
 
 #ifdef TEST_SNPRINTF
@@ -767,7 +767,7 @@ int main (void)
     for (y = 0; fp_nums[y] != 0; y++) {
       snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]);
       sprintf (buf2, fp_fmt[x], fp_nums[y]);
-      if (mutt_strcmp (buf1, buf2)) {
+      if (safe_strcmp (buf1, buf2)) {
         printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
                 fp_fmt[x], buf1, buf2);
         fail++;
@@ -779,7 +779,7 @@ int main (void)
     for (y = 0; int_nums[y] != 0; y++) {
       snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]);
       sprintf (buf2, int_fmt[x], int_nums[y]);
-      if (mutt_strcmp (buf1, buf2)) {
+      if (safe_strcmp (buf1, buf2)) {
         printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
                 int_fmt[x], buf1, buf2);
         fail++;
diff --git a/sort.c b/sort.c
index 847eb25..20bc777 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -81,7 +81,7 @@ int compare_subject (const void *a, const void *b)
   else if (!(*pb)->env->real_subj)
     rc = 1;
   else
-    rc = mutt_strcasecmp ((*pa)->env->real_subj, (*pb)->env->real_subj);
+    rc = safe_strcasecmp ((*pa)->env->real_subj, (*pb)->env->real_subj);
   AUXSORT (rc, a, b);
   return (SORTCODE (rc));
 }
@@ -122,7 +122,7 @@ int compare_to (const void *a, const void *b)
   strncpy (fb, mutt_get_name ((*ppb)->env->to), sizeof (fb));
   fb[sizeof (fb) - 1] = '\0';
 
-  result = mutt_strcasecmp (fa, fb);
+  result = safe_strcasecmp (fa, fb);
   AUXSORT (result, a, b);
   return (SORTCODE (result));
 }
@@ -145,7 +145,7 @@ int compare_from (const void *a, const void *b)
   strncpy (fb, mutt_get_name ((*ppb)->env->from), sizeof (fb));
   fb[sizeof (fb) - 1] = '\0';
 
-  result = mutt_strcasecmp (fa, fb);
+  result = safe_strcasecmp (fa, fb);
   AUXSORT (result, a, b);
   return (SORTCODE (result));
 }
@@ -213,13 +213,13 @@ int compare_spam (const void *a, const void *b)
   /* If either aptr or bptr is equal to data, there is no numeric    */
   /* value for that spam attribute. In this case, compare lexically. */
   if ((aptr == (*ppa)->env->spam->data) || (bptr == (*ppb)->env->spam->data))
-    return (SORTCODE (mutt_strcmp (aptr, bptr)));
+    return (SORTCODE (safe_strcmp (aptr, bptr)));
 
   /* Otherwise, we have numeric value for both attrs. If these values */
   /* are equal, then we first fall back upon string comparison, then  */
   /* upon auxiliary sort.                                             */
   if (result == 0) {
-    result = mutt_strcmp (aptr, bptr);
+    result = safe_strcmp (aptr, bptr);
     if (result == 0)
       AUXSORT (result, a, b);
   }
index df1aa09..a470ae3 100644 (file)
--- a/status.c
+++ b/status.c
@@ -240,7 +240,7 @@ static const char *status_format_str (char *buf, size_t buflen, char op,
 
       if (!StChars)
         buf[0] = 0;
-      else if (i >= mutt_strlen (StChars))
+      else if (i >= safe_strlen (StChars))
         buf[0] = StChars[0];
       else
         buf[0] = StChars[i];
index bc6f29d..814e00e 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -338,7 +338,7 @@ static LIST *make_subject_list (THREAD * cur, time_t * dateptr)
         ((env->real_subj != env->subject) || (!option (OPTSORTRE)))) {
       for (curlist = subjects, oldlist = NULL;
            curlist; oldlist = curlist, curlist = curlist->next) {
-        rc = mutt_strcmp (env->real_subj, curlist->data);
+        rc = safe_strcmp (env->real_subj, curlist->data);
         if (rc >= 0)
           break;
       }
@@ -398,7 +398,7 @@ static THREAD *find_subject (CONTEXT * ctx, THREAD * cur)
             (last->message->received < tmp->message->received) :
             (last->message->date_sent < tmp->message->date_sent))) &&
           tmp->message->env->real_subj &&
-          mutt_strcmp (subjects->data, tmp->message->env->real_subj) == 0)
+          safe_strcmp (subjects->data, tmp->message->env->real_subj) == 0)
         last = tmp;             /* best match so far */
     }
 
@@ -471,7 +471,7 @@ static void pseudo_threads (CONTEXT * ctx)
          * parent, since otherwise they rightly belong to the message
          * we're attaching. */
         if (tmp == cur
-            || !mutt_strcmp (tmp->message->env->real_subj,
+            || !safe_strcmp (tmp->message->env->real_subj,
                              parent->message->env->real_subj)) {
           tmp->message->subject_changed = 0;
 
@@ -669,7 +669,7 @@ static void check_subjects (CONTEXT * ctx, int init)
     if (!tmp)
       cur->subject_changed = 1;
     else if (cur->env->real_subj && tmp->message->env->real_subj)
-      cur->subject_changed = mutt_strcmp (cur->env->real_subj,
+      cur->subject_changed = safe_strcmp (cur->env->real_subj,
                                           tmp->message->env->
                                           real_subj) ? 1 : 0;
     else
@@ -821,7 +821,7 @@ void mutt_sort_threads (CONTEXT * ctx, int init)
         if (!cur->env->references)
           ref = ref->next;
         else {
-          if (mutt_strcmp (ref->data, cur->env->references->data))
+          if (safe_strcmp (ref->data, cur->env->references->data))
             ref = cur->env->references;
           else
             ref = cur->env->references->next;
@@ -1250,7 +1250,7 @@ static void clean_references (THREAD * brk, THREAD * cur)
     for (p = brk; !done && p; p = p->parent)
       for (ref = cur->message->env->references; p->message && ref;
            ref = ref->next)
-        if (!mutt_strcasecmp (ref->data, p->message->env->message_id)) {
+        if (!safe_strcasecmp (ref->data, p->message->env->message_id)) {
           done = 1;
           break;
         }
diff --git a/url.c b/url.c
index 1740c24..a7cb3c3 100644 (file)
--- a/url.c
+++ b/url.c
@@ -172,7 +172,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags)
 
   if (ciss->host) {
     safe_strcat (dest, len, "//");
-    len -= (l = mutt_strlen (dest));
+    len -= (l = safe_strlen (dest));
     dest += l;
 
     if (ciss->user) {
@@ -181,7 +181,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags)
       else
         snprintf (dest, len, "%s@", ciss->user);
 
-      len -= (l = mutt_strlen (dest));
+      len -= (l = safe_strlen (dest));
       dest += l;
     }
 
@@ -234,10 +234,10 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src)
 
     if (!ascii_strcasecmp (tag, "body")) {
       if (body)
-        mutt_str_replace (body, value);
+        str_replace (body, value);
     }
     else {
-      taglen = mutt_strlen (tag);
+      taglen = safe_strlen (tag);
       /* mutt_parse_rfc822_line makes some assumptions */
       snprintf (scratch, sizeof (scratch), "%s: %s", tag, value);
       scratch[taglen] = '\0';