Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 8 Aug 2005 10:25:04 +0000 (10:25 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 8 Aug 2005 10:25:04 +0000 (10:25 +0000)
- repair string library function naming fuckup once and for all, see updated doc/devel-notes.txt

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

95 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
doc/devel-notes.txt
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.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/mx_imap.c
imap/utf7.c
imap/util.c
init.c
keymap.c
lib.c
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
muttlib.c
mx.c
nntp/newsrc.c
nntp/nntp.c
pager.c
parse.c
pattern.c
pgp.c
pgpkey.c
pgplib.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
strdup.c
thread.c
url.c

index a5b4ff9..7006935 100644 (file)
--- a/account.c
+++ b/account.c
@@ -54,11 +54,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 (!str_cmp (a1->user, a2->user));
   if (a1->flags & M_ACCT_USER)
-    return (!mutt_strcmp (a1->user, user));
+    return (!str_cmp (a1->user, user));
   if (a2->flags & M_ACCT_USER)
-    return (!mutt_strcmp (a2->user, user));
+    return (!str_cmp (a2->user, user));
 
   return 1;
 }
index 6d34f74..7528a14 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 = safe_strcasecmp (pa->name, pb->name);
+  int r = str_casecmp (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 = safe_strcasecmp (pa->personal, pb->personal);
+      r = str_casecmp (pa->personal, pb->personal);
     else
       r = 1;
   }
diff --git a/alias.c b/alias.c
index 8835fa9..9005f48 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -29,7 +29,7 @@ ADDRESS *mutt_lookup_alias (const char *s)
   ALIAS *t = Aliases;
 
   for (; t; t = t->next)
-    if (!safe_strcasecmp (s, t->name))
+    if (!str_casecmp (s, t->name))
       return (t->addr);
   return (NULL);                /* no such alias */
 }
@@ -49,7 +49,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 (str_cmp (a->mailbox, u->data) == 0) { /* alias already found */
             debug_print(1, ("loop in alias found for '%s'\n", a->mailbox));
             i = 1;
             break;
@@ -58,7 +58,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS * a, LIST ** expn)
 
         if (!i) {
           u = safe_malloc (sizeof (LIST));
-          u->data = safe_strdup (a->mailbox);
+          u->data = str_dup (a->mailbox);
           u->next = *expn;
           *expn = u;
           w = rfc822_cpy_adr (t);
@@ -240,7 +240,7 @@ retry_name:
 
   new = safe_calloc (1, sizeof (ALIAS));
   new->self = new;
-  new->name = safe_strdup (buf);
+  new->name = str_dup (buf);
 
   mutt_addrlist_to_local (adr);
 
@@ -276,7 +276,7 @@ retry_name:
     mutt_free_alias (&new);
     return;
   }
-  new->addr->personal = safe_strdup (buf);
+  new->addr->personal = str_dup (buf);
 
   buf[0] = 0;
   rfc822_write_address (buf, sizeof (buf), new->addr, 1);
@@ -392,7 +392,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 (str_len (a->name) + 1, sizeof (bestname)));
         else {
           for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++);
           bestname[i] = 0;
@@ -402,9 +402,9 @@ int mutt_alias_complete (char *s, size_t buflen)
     }
 
     if (bestname[0] != 0) {
-      if (mutt_strcmp (bestname, s) != 0) {
+      if (str_cmp (bestname, s) != 0) {
         /* we are adding something to the completion */
-        strfcpy (s, bestname, mutt_strlen (bestname) + 1);
+        strfcpy (s, bestname, str_len (bestname) + 1);
         return 1;
       }
 
diff --git a/ascii.h b/ascii.h
index 0fcec5c..2c0a42b 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) safe_strncmp(a,b,c)
+#define ascii_strcmp(a,b) str_cmp(a,b)
+#define ascii_strncmp(a,b,c) str_ncmp(a,b,c)
 
 #endif
index a2809ce..c87f9cf 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -272,7 +272,7 @@ static int is_mmnoask (const char *buf)
   int lng;
 
   if ((p = getenv ("MM_NOASK")) != NULL && *p) {
-    if (mutt_strcmp (p, "1") == 0)
+    if (str_cmp (p, "1") == 0)
       return (1);
 
     strfcpy (tmp, p, sizeof (tmp));
@@ -290,8 +290,8 @@ static int is_mmnoask (const char *buf)
         }
       }
       else {
-        lng = mutt_strlen (p);
-        if (buf[lng] == '/' && safe_strncasecmp (buf, p, lng) == 0)
+        lng = str_len (p);
+        if (buf[lng] == '/' && str_ncasecmp (buf, p, lng) == 0)
           return (1);
       }
 
@@ -308,7 +308,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 = str_len (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) {
@@ -359,7 +359,7 @@ int mutt_is_autoview (BODY * b, const char *type)
   }
 
   for (; t; t = t->next) {
-    i = mutt_strlen (t->data) - 1;
+    i = str_len (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)
@@ -420,7 +420,7 @@ int mutt_view_attachment (FILE * fp, BODY * a, int flag, HEADER * hdr,
     strfcpy (command, entry->command, sizeof (command));
 
     if (fp) {
-      fname = safe_strdup (a->filename);
+      fname = str_dup (a->filename);
       mutt_sanitize_filename (fname, 1);
     }
     else
@@ -428,7 +428,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 && str_cmp (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 5cfd37e..10ecc02 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -91,7 +91,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 = safe_strcoll (pa->name, pb->name);
+  int r = str_coll (pa->name, pb->name);
 
   return ((BrowserSort & SORT_REVERSE) ? -r : r);
 }
@@ -442,8 +442,8 @@ static void add_folder (MUTTMENU * m, struct browser_state *state,
   }
 
   (state->entry)[state->entrylen].new = new;
-  (state->entry)[state->entrylen].name = safe_strdup (name);
-  (state->entry)[state->entrylen].desc = safe_strdup (name);
+  (state->entry)[state->entrylen].name = str_dup (name);
+  (state->entry)[state->entrylen].desc = str_dup (name);
 #ifdef USE_IMAP
   (state->entry)[state->entrylen].imap = 0;
 #endif
@@ -485,7 +485,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)
+                                        str_len (prefix)) != 0)
         continue;
       if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
         continue;
@@ -530,11 +530,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 (str_cmp (de->d_name, ".") == 0)
         continue;               /* we don't need . */
 
       if (prefix && *prefix
-          && safe_strncmp (prefix, de->d_name, mutt_strlen (prefix)) != 0)
+          && str_ncmp (prefix, de->d_name, str_len (prefix)) != 0)
         continue;
       if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
         continue;
@@ -775,7 +775,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 = str_len (f) - 1; i > 0 && f[i] != '/'; i--);
       if (i > 0) {
         if (f[0] == '/') {
           if (i > sizeof (LastDir) - 1)
@@ -785,8 +785,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
         }
         else {
           getcwd (LastDir, sizeof (LastDir));
-          safe_strcat (LastDir, sizeof (LastDir), "/");
-          safe_strncat (LastDir, sizeof (LastDir), f, i);
+          str_cat (LastDir, sizeof (LastDir), "/");
+          str_ncat (LastDir, sizeof (LastDir), f, i);
         }
       }
       else {
@@ -891,8 +891,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 (str_cmp (state.entry[menu->current].name, "..") == 0) {
+            if (str_cmp ("..", LastDir + str_len (LastDir) - 2) == 0)
               strcat (LastDir, "/..");  /* __STRCAT_CHECKED__ */
             else {
               char *p = strrchr (LastDir + 1, '/');
@@ -920,7 +920,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 = str_len (LastDir) + 1;
 
             /* special case "" needs no delimiter */
             url_parse_ciss (&url, state.entry[menu->current].name);
@@ -1004,7 +1004,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
             if (ff.tagged) {
               mutt_concat_path (full, LastDir, ff.name, sizeof (full));
               mutt_expand_path (full, sizeof (full));
-              tfiles[j++] = safe_strdup (full);
+              tfiles[j++] = str_dup (full);
             }
           }
           *files = tfiles;
@@ -1013,7 +1013,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
           *numfiles = 1;
           tfiles = safe_calloc (*numfiles, sizeof (char *));
           mutt_expand_path (f, flen);
-          tfiles[0] = safe_strdup (f);
+          tfiles[0] = str_dup (f);
           *files = tfiles;
         }
       }
@@ -1125,7 +1125,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 = str_len (LastDir);
 
         if (len && LastDir[len - 1] != '/' && sizeof (buf) > len)
           buf[len] = '/';
@@ -1388,7 +1388,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
            mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
                  newsgroup_format_str, (unsigned long) &folder,
                  M_FORMAT_ARROWCURSOR);
-           f->desc = safe_strdup (buffer); */
+           f->desc = str_dup (buffer); */
           if (menu->current + 1 < menu->max)
             menu->current++;
           menu->redraw = REDRAW_MOTION_RESYNCH;
@@ -1486,7 +1486,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
                mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
                        newsgroup_format_str, (unsigned long) &folder,
                        M_FORMAT_ARROWCURSOR);
-               f->desc = safe_strdup (buffer);
+               f->desc = str_dup (buffer);
              } */
           }
           if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE) {
diff --git a/buffy.c b/buffy.c
index 4ede93b..ac8ef46 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -71,13 +71,13 @@ static 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 * str_len(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 (!safe_strncmp (buffer + i, "\n\nFrom ", mutt_strlen ("\n\nFrom "))) { /* found it - go to the beginning of the From */
+      if (!str_ncmp (buffer + i, "\n\nFrom ", str_len ("\n\nFrom "))) { /* found it - go to the beginning of the From */
         fseek (f, pos + i + 2, SEEK_SET);
         return 0;
       }
@@ -85,7 +85,7 @@ static int fseek_last_message (FILE * f)
   }
 
   /* here we are at the beginning of the file */
-  if (!safe_strncmp ("From ", buffer, 5)) {
+  if (!str_ncmp ("From ", buffer, 5)) {
     fseek (f, 0, 0);
     return (0);
   }
@@ -220,7 +220,7 @@ int buffy_parse_mailboxes (BUFFER * path, BUFFER * s, unsigned long data,
 
     if (i < 0) {
       tmp = safe_calloc (1, sizeof (BUFFY));
-      tmp->path = safe_strdup (buf);
+      tmp->path = str_dup (buf);
       tmp->magic = 0;
       list_push_back (&Incoming, tmp);
       i = Incoming->length-1;
@@ -511,7 +511,7 @@ int 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 += str_len (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];
@@ -522,19 +522,19 @@ int buffy_list (void)
       strfcpy (path, tmp->path, sizeof (path));
       mutt_pretty_mailbox (path);
 
-      if (!first && pos + mutt_strlen (path) >= COLS - 7)
+      if (!first && pos + str_len (path) >= COLS - 7)
         break;
 
       if (!first)
-        pos += mutt_strlen (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos));    /* __STRNCAT_CHECKED__ */
+        pos += str_len (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 += str_len (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 += str_len (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos));      /* __STRNCAT_CHECKED__ */
       first = 0;
     }
   }
index 46de91c..5f3a273 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -195,15 +195,15 @@ void mutt_set_langinfo_charset (void)
   mutt_canonical_charset (buff2, sizeof (buff2), buff);
 
   /* finally, set $charset */
-  if (!(Charset = safe_strdup (buff2)))
-    Charset = safe_strdup ("iso-8859-1");
+  if (!(Charset = str_dup (buff2)))
+    Charset = str_dup ("iso-8859-1");
 }
 
 #else
 
 void mutt_set_langinfo_charset (void)
 {
-  Charset = safe_strdup ("iso-8859-1");
+  Charset = str_dup ("iso-8859-1");
 }
 
 #endif
@@ -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) ||
-        !safe_strcasecmp (scratch, PreferredMIMENames[i].key)) {
+        !str_casecmp (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 = str_len (*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 = str_len (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 = str_len (s);
     ib = s, ibl = len + 1;
     obl = MB_LEN_MAX * ibl;
     ob = buf = safe_malloc (obl + 1);
@@ -561,7 +561,7 @@ char *mutt_get_first_charset (const char *charset)
   const char *c, *c1;
 
   c = charset;
-  if (!mutt_strlen (c))
+  if (!str_len (c))
     return "us-ascii";
   if (!(c1 = strchr (c, ':')))
     return ((char*) 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 = str_len (*ps);
     size_t slen;
 
     if (!u || !*u)
       return 0;
 
     c1 = strchr (c, ':');
-    n = c1 ? c1 - c : mutt_strlen (c);
+    n = c1 ? c1 - c : str_len (c);
     if (!n)
       continue;
     fromcode = safe_malloc (n + 1);
diff --git a/color.c b/color.c
index 6266e67..51d2f83 100644 (file)
--- a/color.c
+++ b/color.c
@@ -295,13 +295,13 @@ parse_color_name (const char *s, int *col, int *attr, int brite, BUFFER * err)
 {
   char *eptr;
 
-  if (safe_strncasecmp (s, "bright", 6) == 0) {
+  if (str_ncasecmp (s, "bright", 6) == 0) {
     *attr |= brite;
     s += 6;
   }
 
   /* allow aliases for xterm color resources */
-  if (safe_strncasecmp (s, "color", 5) == 0) {
+  if (str_ncasecmp (s, "color", 5) == 0) {
     s += 5;
     *col = strtol (s, &eptr, 10);
     if (!*s || *eptr || *col < 0 ||
@@ -361,7 +361,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
     return (-1);
   }
 
-  if (safe_strncmp (buf->data, "index", 5) != 0) {
+  if (str_ncmp (buf->data, "index", 5) != 0) {
     snprintf (err->data, err->dsize,
               _("%s: command valid only for index object"),
               parse_uncolor ? "uncolor" : "unmono");
@@ -399,7 +399,7 @@ _mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
 
   do {
     mutt_extract_token (buf, s, 0);
-    if (!mutt_strcmp ("*", buf->data)) {
+    if (!str_cmp ("*", buf->data)) {
       for (tmp = ColorIndexList; tmp;) {
         if (!do_cache)
           do_cache = 1;
@@ -412,7 +412,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 (!str_cmp (buf->data, tmp->pattern)) {
           if (!do_cache)
             do_cache = 1;
           debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern));
@@ -454,11 +454,11 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive,
 
   while (tmp) {
     if (sensitive) {
-      if (mutt_strcmp (s, tmp->pattern) == 0)
+      if (str_cmp (s, tmp->pattern) == 0)
         break;
     }
     else {
-      if (safe_strcasecmp (s, tmp->pattern) == 0)
+      if (str_casecmp (s, tmp->pattern) == 0)
         break;
     }
     tmp = tmp->next;
@@ -507,7 +507,7 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive,
       return (-1);
     }
     tmp->next = *top;
-    tmp->pattern = safe_strdup (s);
+    tmp->pattern = str_dup (s);
 #ifdef HAVE_COLOR
     if (fg != -1 && bg != -1) {
       tmp->fg = fg;
@@ -534,7 +534,7 @@ parse_object (BUFFER * buf, BUFFER * s, int *o, int *ql, BUFFER * err)
   }
 
   mutt_extract_token (buf, s, 0);
-  if (!safe_strncmp (buf->data, "quoted", 6)) {
+  if (!str_ncmp (buf->data, "quoted", 6)) {
     if (buf->data[6]) {
       *ql = strtol (buf->data + 6, &eptr, 10);
       if (*eptr || q_level < 0) {
index fb62f07..9475e38 100644 (file)
@@ -92,7 +92,7 @@ int mutt_display_message (HEADER * cur)
     }
   }
 
-  if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
+  if (!Pager || str_cmp (Pager, "builtin") == 0)
     builtin = 1;
   else {
     mutt_make_string (buf, sizeof (buf), NONULL (PagerFmt), Context, cur);
@@ -279,10 +279,10 @@ void ci_bounce_message (HEADER * h, int *redraw)
     mutt_format_string (prompt, sizeof (prompt),
                         0, COLS - extra_space, 0, 0,
                         prompt, sizeof (prompt), 0);
-    safe_strcat (prompt, sizeof (prompt), "...?");
+    str_cat (prompt, sizeof (prompt), "...?");
   }
   else
-    safe_strcat (prompt, sizeof (prompt), "?");
+    str_cat (prompt, sizeof (prompt), "?");
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
     rfc822_free_address (&adr);
@@ -738,7 +738,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 (str_cmp (buf, ".") == 0)
     strfcpy (buf, LastSaveFolder, sizeof (buf));
   else
     strfcpy (LastSaveFolder, buf, sizeof (LastSaveFolder));
@@ -869,7 +869,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) && !safe_strcasecmp (buf + 3, section))
+      if (!strncmp (buf, "#: ", 3) && !str_casecmp (buf + 3, section))
         done++;
     }
     if (r != EOF && !done) {
@@ -897,8 +897,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, str_len (key)) &&
+             (!*key || buf[str_len (key)] == ' ')) {
       c = buf;
       ext = 0;
       while (*c && (*c != '\r') && (*c != '\n'))
@@ -967,7 +967,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 = str_len (buf);
 
       rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
       snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
index 2c0f14e..c909486 100644 (file)
@@ -60,7 +60,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 = str_len (filepart)) == 0) {
       for (; l; l = l->next) {
         NNTP_DATA *data = (NNTP_DATA *) l->data;
 
@@ -77,7 +77,7 @@ int mutt_complete (char *s, size_t slen)
       NNTP_DATA *data = (NNTP_DATA *) l->data;
 
       if (data && data->subscribed &&
-          safe_strncmp (data->group, filepart, len) == 0) {
+          str_ncmp (data->group, filepart, len) == 0) {
         if (init) {
           for (i = 0; filepart[i] && data->group[i]; i++) {
             if (filepart[i] != data->group[i]) {
@@ -176,10 +176,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 = str_len (filepart)) == 0) {
     while ((de = readdir (dirp)) != NULL) {
-      if (mutt_strcmp (".", de->d_name) != 0
-          && mutt_strcmp ("..", de->d_name) != 0) {
+      if (str_cmp (".", de->d_name) != 0
+          && str_cmp ("..", de->d_name) != 0) {
         strfcpy (filepart, de->d_name, sizeof (filepart));
         init++;
         break;
@@ -188,7 +188,7 @@ int mutt_complete (char *s, size_t slen)
   }
 
   while ((de = readdir (dirp)) != NULL) {
-    if (safe_strncmp (de->d_name, filepart, len) == 0) {
+    if (str_ncmp (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]) {
@@ -207,14 +207,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 + str_len (buf), "/", sizeof (buf) - str_len (buf));
         }
         else
           buf[0] = 0;
-        strfcpy (buf + mutt_strlen (buf), filepart, sizeof (buf) - mutt_strlen (buf));
+        strfcpy (buf + str_len (buf), filepart, sizeof (buf) - str_len (buf));
         if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR))
-          strfcpy (filepart + mutt_strlen (filepart), "/",
-                   sizeof (filepart) - mutt_strlen (filepart));
+          strfcpy (filepart + str_len (filepart), "/",
+                   sizeof (filepart) - str_len (filepart));
         init = 1;
       }
     }
@@ -223,10 +223,10 @@ int mutt_complete (char *s, size_t slen)
 
   if (dirpart[0]) {
     strfcpy (s, dirpart, slen);
-    if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '='
+    if (str_cmp ("/", 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 + str_len (s), "/", slen - str_len (s));
+    strfcpy (s + str_len (s), filepart, slen - str_len (s));
   }
   else
     strfcpy (s, filepart, slen);
index aacfd8d..f2afd32 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 + str_len (t) + 2 >= COLS - SidebarWidth)
       break;
 
     addstr (NONULL (t));
     if (chain->next)
       addstr (", ");
 
-    c += mutt_strlen (t) + 2;
+    c += str_len (t) + 2;
   }
 }
 #endif /* MIXMASTER */
@@ -619,7 +619,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
             && buf[0]) {
           FREE (&msg->env->newsgroups);
           str_skip_trailws (buf);
-          msg->env->newsgroups = safe_strdup (str_skip_initws (buf));
+          msg->env->newsgroups = str_dup (str_skip_initws (buf));
           move (HDR_TO, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->newsgroups)
@@ -637,7 +637,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
             && buf[0]) {
           FREE (&msg->env->followup_to);
           str_skip_trailws (buf);
-          msg->env->followup_to = safe_strdup (str_skip_initws (buf));
+          msg->env->followup_to = str_dup (str_skip_initws (buf));
           move (HDR_CC, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->followup_to)
@@ -654,7 +654,7 @@ int mutt_compose_menu (HEADER * msg,    /* structure for new message */
         if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0
             && buf[0]) {
           FREE (&msg->env->x_comment_to);
-          msg->env->x_comment_to = safe_strdup (buf);
+          msg->env->x_comment_to = str_dup (buf);
           move (HDR_BCC, HDR_XOFFSET);
           clrtoeol ();
           if (msg->env->x_comment_to)
@@ -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 && (str_cmp ("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 (str_cmp ("builtin", Editor) != 0 &&
           (op == OP_COMPOSE_EDIT_HEADERS ||
            (op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) {
         char *tag = NULL, *err = NULL;
index 7362c55..a483b9e 100644 (file)
@@ -130,7 +130,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 (str_len (tmppath) + 1);
   strcpy (ctx->path, tmppath);
 }
 
@@ -189,7 +189,7 @@ static char *get_compression_cmd (const char *cmd, const CONTEXT * ctx)
 
   mutt_FormatString (expanded, sizeof (expanded), cmd,
                      compresshook_format_str, (unsigned long) ctx, 0);
-  return safe_strdup (expanded);
+  return str_dup (expanded);
 }
 
 int mutt_check_mailbox_compressed (CONTEXT * ctx)
diff --git a/copy.c b/copy.c
index d9a6fb9..cbca670 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 && safe_strncmp ("From ", buf, 5) == 0) {
+        if (!from && str_ncmp ("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], str_len (headers[x]) +
+                        str_len (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 && safe_strncmp ("From ", buf, 5) == 0) {
+      if (!from && str_ncmp ("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, str_len (t->data))) {
             debug_print (2, ("Reorder: %s matches %s\n", t->data, buf));
             break;
           }
@@ -211,10 +211,10 @@ mutt_copy_hdr (FILE * in, FILE * out, long off_start, long off_end, int flags,
     if (!ignore) {
       debug_print (2, ("Reorder: x = %d; hdr_count = %d\n", x, hdr_count));
       if (!this_one)
-        this_one = safe_strdup (buf);
+        this_one = str_dup (buf);
       else {
         safe_realloc (&this_one,
-                      mutt_strlen (this_one) + mutt_strlen (buf) +
+                      str_len (this_one) + str_len (buf) +
                       sizeof (char));
         strcat (this_one, buf); /* __STRCAT_CHECKED__ */
       }
@@ -231,8 +231,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], str_len (headers[x]) +
+                    str_len (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[str_len (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, str_len (date));
 
       /* Copy the headers */
       if (mutt_copy_header (fpin, hdr, fpout,
@@ -804,7 +804,7 @@ static void format_address_header (char **h, ADDRESS * a)
 
   int l, linelen, buflen, count;
 
-  linelen = mutt_strlen (*h);
+  linelen = str_len (*h);
   buflen = linelen + 3;
 
 
@@ -817,7 +817,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 = str_len (buf);
     if (count && linelen + l > 74) {
       strcpy (cbuf, "\n\t");    /* __STRCPY_CHECKED__ */
       linelen = l + 8;
@@ -835,7 +835,7 @@ static void format_address_header (char **h, ADDRESS * a)
       strcpy (c2buf, ",");      /* __STRCPY_CHECKED__ */
     }
 
-    buflen += l + mutt_strlen (cbuf) + mutt_strlen (c2buf);
+    buflen += l + str_len (cbuf) + str_len (c2buf);
     safe_realloc (h, buflen);
     strcat (*h, cbuf);          /* __STRCAT_CHECKED__ */
     strcat (*h, buf);           /* __STRCAT_CHECKED__ */
index b9b7613..f22ca2d 100644 (file)
@@ -149,7 +149,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)) && (str_len (s) == 16))
       /* Return only the short keyID.  */
       s += 8;
   }
@@ -295,11 +295,11 @@ static int crypt_id_matches_addr (ADDRESS * addr, ADDRESS * u_addr,
     rv |= CRYPT_KV_STRONGID;
 
   if (addr->mailbox && u_addr->mailbox
-      && safe_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
+      && str_casecmp (addr->mailbox, u_addr->mailbox) == 0)
     rv |= CRYPT_KV_ADDR;
 
   if (addr->personal && u_addr->personal
-      && safe_strcasecmp (addr->personal, u_addr->personal) == 0)
+      && str_casecmp (addr->personal, u_addr->personal) == 0)
     rv |= CRYPT_KV_STRING;
 
   return rv;
@@ -505,7 +505,7 @@ static char *data_object_to_tempfile (gpgme_data_t data, FILE ** ret_fp)
   }
   if (ret_fp)
     *ret_fp = fp;
-  return safe_strdup (tempfile);
+  return str_dup (tempfile);
 }
 
 
@@ -757,7 +757,7 @@ static BODY *sign_message (BODY * a, int use_smime)
 
   t = mutt_new_body ();
   t->type = TYPEMULTIPART;
-  t->subtype = safe_strdup ("signed");
+  t->subtype = str_dup ("signed");
   t->encoding = ENC7BIT;
   t->use_disp = 0;
   t->disposition = DISPINLINE;
@@ -781,15 +781,15 @@ static BODY *sign_message (BODY * a, int use_smime)
   t = t->parts->next;
   t->type = TYPEAPPLICATION;
   if (use_smime) {
-    t->subtype = safe_strdup ("pkcs7-signature");
+    t->subtype = str_dup ("pkcs7-signature");
     mutt_set_parameter ("name", "smime.p7s", &t->parameter);
     t->encoding = ENCBASE64;
     t->use_disp = 1;
     t->disposition = DISPATTACH;
-    t->d_filename = safe_strdup ("smime.p7s");
+    t->d_filename = str_dup ("smime.p7s");
   }
   else {
-    t->subtype = safe_strdup ("pgp-signature");
+    t->subtype = str_dup ("pgp-signature");
     t->use_disp = 0;
     t->disposition = DISPINLINE;
     t->encoding = ENC7BIT;
@@ -844,7 +844,7 @@ BODY *pgp_gpgme_encrypt_message (BODY * a, char *keylist, int sign)
 
   t = mutt_new_body ();
   t->type = TYPEMULTIPART;
-  t->subtype = safe_strdup ("encrypted");
+  t->subtype = str_dup ("encrypted");
   t->encoding = ENC7BIT;
   t->use_disp = 0;
   t->disposition = DISPINLINE;
@@ -854,18 +854,18 @@ BODY *pgp_gpgme_encrypt_message (BODY * a, char *keylist, int sign)
 
   t->parts = mutt_new_body ();
   t->parts->type = TYPEAPPLICATION;
-  t->parts->subtype = safe_strdup ("pgp-encrypted");
+  t->parts->subtype = str_dup ("pgp-encrypted");
   t->parts->encoding = ENC7BIT;
 
   t->parts->next = mutt_new_body ();
   t->parts->next->type = TYPEAPPLICATION;
-  t->parts->next->subtype = safe_strdup ("octet-stream");
+  t->parts->next->subtype = str_dup ("octet-stream");
   t->parts->next->encoding = ENC7BIT;
   t->parts->next->filename = outfile;
   t->parts->next->use_disp = 1;
   t->parts->next->disposition = DISPINLINE;
   t->parts->next->unlink = 1;   /* delete after sending the message */
-  t->parts->next->d_filename = safe_strdup ("msg.asc"); /* non pgp/mime
+  t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime
                                                            can save */
 
   return t;
@@ -902,13 +902,13 @@ BODY *smime_gpgme_build_smime_entity (BODY * a, char *keylist)
 
   t = mutt_new_body ();
   t->type = TYPEAPPLICATION;
-  t->subtype = safe_strdup ("pkcs7-mime");
+  t->subtype = str_dup ("pkcs7-mime");
   mutt_set_parameter ("name", "smime.p7m", &t->parameter);
   mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter);
   t->encoding = ENCBASE64;      /* The output of OpenSSL SHOULD be binary */
   t->use_disp = 1;
   t->disposition = DISPATTACH;
-  t->d_filename = safe_strdup ("smime.p7m");
+  t->d_filename = str_dup ("smime.p7m");
   t->filename = outfile;
   t->unlink = 1;                /*delete after sending the message */
   t->parts = 0;
@@ -1003,7 +1003,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 && !str_cmp (t0, t1))) {
         if (t0)
           state_attach_puts (",", s);
         state_attach_puts (t1, s);
@@ -1030,10 +1030,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 (str_len (prefix) + str_len (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 + str_len (buf);
+  if (is_pgp && str_len (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];
@@ -1298,7 +1298,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[str_len (notation->value) - 1] ==
                         '\n')))
                 state_attach_puts ("\n", s);
             }
@@ -1656,10 +1656,10 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b,
   }
 
   while (fgets (buf, sizeof (buf), tfp)) {
-    if (!safe_strncmp ("-----BEGIN PGP ", buf, 15)) {
-      if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+    if (!str_ncmp ("-----BEGIN PGP ", buf, 15)) {
+      if (!str_cmp ("MESSAGE-----\n", buf + 15))
         enc = 1;
-      else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
+      else if (!str_cmp ("SIGNED MESSAGE-----\n", buf + 15))
         sgn = 1;
     }
   }
@@ -1738,7 +1738,7 @@ static void copy_clearsigned (gpgme_data_t data, STATE * s, char *charset)
       continue;
     }
 
-    if (!mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n"))
+    if (!str_cmp (buf, "-----BEGIN PGP SIGNATURE-----\n"))
       break;
 
     if (armor_header) {
@@ -1795,21 +1795,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 str_len(buf) */
     last_pos = offset;
 
-    if (!safe_strncmp ("-----BEGIN PGP ", buf, 15)) {
+    if (!str_ncmp ("-----BEGIN PGP ", buf, 15)) {
       clearsign = 0;
       start_pos = last_pos;
 
-      if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+      if (!str_cmp ("MESSAGE-----\n", buf + 15))
         needpass = 1;
-      else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) {
+      else if (!str_cmp ("SIGNED MESSAGE-----\n", buf + 15)) {
         clearsign = 1;
         needpass = 0;
       }
       else if (!option (OPTDONTHANDLEPGPKEYS) &&
-               !mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) {
+               !str_cmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) {
         needpass = 0;
         pgp_keyblock = 1;
       }
@@ -1825,18 +1825,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, str_len (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 str_len(buf) */
         last_pos = offset;
 
-        gpgme_data_write (armored_data, buf, mutt_strlen (buf));
+        gpgme_data_write (armored_data, buf, str_len (buf));
 
-        if ((needpass && !mutt_strcmp ("-----END PGP MESSAGE-----\n", buf))
+        if ((needpass && !str_cmp ("-----END PGP MESSAGE-----\n", buf))
             || (!needpass
-                && (!mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf)
-                    || !mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
+                && (!str_cmp ("-----END PGP SIGNATURE-----\n", buf)
+                    || !str_cmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
                                      buf))))
           break;
       }
@@ -2368,10 +2368,10 @@ static int _crypt_compare_address (const void *a, const void *b)
   crypt_key_t **t = (crypt_key_t **) b;
   int r;
 
-  if ((r = safe_strcasecmp ((*s)->uid, (*t)->uid)))
+  if ((r = str_casecmp ((*s)->uid, (*t)->uid)))
     return r > 0;
   else
-    return safe_strcasecmp (crypt_keyid (*s), crypt_keyid (*t)) > 0;
+    return str_casecmp (crypt_keyid (*s), crypt_keyid (*t)) > 0;
 }
 
 static int crypt_compare_address (const void *a, const void *b)
@@ -2388,10 +2388,10 @@ static int _crypt_compare_keyid (const void *a, const void *b)
   crypt_key_t **t = (crypt_key_t **) b;
   int r;
 
-  if ((r = safe_strcasecmp (crypt_keyid (*s), crypt_keyid (*t))))
+  if ((r = str_casecmp (crypt_keyid (*s), crypt_keyid (*t))))
     return r > 0;
   else
-    return safe_strcasecmp ((*s)->uid, (*t)->uid) > 0;
+    return str_casecmp ((*s)->uid, (*t)->uid) > 0;
 }
 
 static int crypt_compare_keyid (const void *a, const void *b)
@@ -2417,7 +2417,7 @@ static int _crypt_compare_date (const void *a, const void *b)
   if (ts < tt)
     return 0;
 
-  return safe_strcasecmp ((*s)->uid, (*t)->uid) > 0;
+  return str_casecmp ((*s)->uid, (*t)->uid) > 0;
 }
 
 static int crypt_compare_date (const void *a, const void *b)
@@ -2462,9 +2462,9 @@ static int _crypt_compare_trust (const void *a, const void *b)
   if (ts < tt)
     return 0;
 
-  if ((r = safe_strcasecmp ((*s)->uid, (*t)->uid)))
+  if ((r = str_casecmp ((*s)->uid, (*t)->uid)))
     return r > 0;
-  return (safe_strcasecmp (crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
+  return (str_casecmp (crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
 }
 
 static int crypt_compare_trust (const void *a, const void *b)
@@ -2480,10 +2480,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 (!str_cmp (dn->key, key)) {
       if (any)
         fputs (" + ", fp);
-      print_utf8 (fp, dn->value, mutt_strlen (dn->value));
+      print_utf8 (fp, dn->value, str_len (dn->value));
       any = 1;
     }
   }
@@ -2506,7 +2506,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 (!str_cmp (dn->key, stdpart[i]))
         break;
     }
     if (!stdpart[i]) {
@@ -2759,7 +2759,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, str_len (s));
     else
       parse_and_print_user_id (fp, s);
     putc ('\n', fp);
@@ -2821,7 +2821,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 && str_len (s) == 40) {
       for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) {
         putc (*s, fp);
         putc (s[1], fp);
@@ -2867,7 +2867,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp)
       s = subkey->keyid;
 
       putc ('\n', fp);
-      if (mutt_strlen (s) == 16)
+      if (str_len (s) == 16)
         s += 8;                 /* display only the short keyID */
       fprintf (fp, "Subkey ....: 0x%s", s);
       if (subkey->revoked) {
@@ -2980,7 +2980,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 && str_cmp (s, k->subkeys->fpr)) {
     putc ('\n', fp);
     err = gpgme_op_keylist_start (listctx, s, 0);
     gpgme_key_release (k);
@@ -3109,7 +3109,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app,
     patarr = safe_calloc (n + 1, sizeof *patarr);
     for (l = hints, n = 0; l; l = l->next) {
       if (l->data && *l->data)
-        patarr[n++] = safe_strdup (l->data);
+        patarr[n++] = str_dup (l->data);
     }
     patarr[n] = NULL;
     err = gpgme_op_keylist_ext_start (ctx, (const char **) patarr, secret, 0);
@@ -3214,12 +3214,12 @@ static LIST *crypt_add_string_to_hints (LIST * hints, const char *str)
   char *scratch;
   char *t;
 
-  if ((scratch = safe_strdup (str)) == NULL)
+  if ((scratch = str_dup (str)) == NULL)
     return hints;
 
   for (t = strtok (scratch, " ,.:\"()<>\n"); t;
        t = strtok (NULL, " ,.:\"()<>\n")) {
-    if (mutt_strlen (t) > 3)
+    if (str_len (t) > 3)
       hints = mutt_add_list (hints, t);
   }
 
@@ -3568,12 +3568,12 @@ static crypt_key_t *crypt_getkeybystr (char *p, short abilities,
     match = 0;
     debug_print (5, ("matching \"%s\" against " "key %s, \"%s\":\n", p, crypt_keyid (k), k->uid));
 
-    if (!*p || !safe_strcasecmp (p, crypt_keyid (k))
-        || (!safe_strncasecmp (p, "0x", 2)
-            && !safe_strcasecmp (p + 2, crypt_keyid (k)))
+    if (!*p || !str_casecmp (p, crypt_keyid (k))
+        || (!str_ncasecmp (p, "0x", 2)
+            && !str_casecmp (p + 2, crypt_keyid (k)))
         || (option (OPTPGPLONGIDS)
-            && !safe_strncasecmp (p, "0x", 2)
-            && !safe_strcasecmp (p + 2, crypt_keyid (k) + 8))
+            && !str_ncasecmp (p, "0x", 2)
+            && !str_casecmp (p + 2, crypt_keyid (k) + 8))
         || str_isstr (k->uid, p)) {
       crypt_key_t *tmp;
 
@@ -3620,7 +3620,7 @@ static crypt_key_t *crypt_ask_for_key (char *tag,
   if (whatfor) {
 
     for (l = id_defaults; l; l = l->next)
-      if (!safe_strcasecmp (whatfor, l->what)) {
+      if (!str_casecmp (whatfor, l->what)) {
         strfcpy (resp, NONULL (l->dflt), sizeof (resp));
         break;
       }
@@ -3639,8 +3639,8 @@ static crypt_key_t *crypt_ask_for_key (char *tag,
         l = safe_malloc (sizeof (struct crypt_cache));
         l->next = id_defaults;
         id_defaults = l;
-        l->what = safe_strdup (whatfor);
-        l->dflt = safe_strdup (resp);
+        l->what = str_dup (whatfor);
+        l->dflt = str_dup (resp);
       }
     }
 
@@ -3765,12 +3765,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 += str_len (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 = str_len (keylist);
 
     crypt_free_key (&key);
     rfc822_free_address (&addr);
@@ -3924,9 +3924,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 = str_len (sender->mailbox);
       for (uid = key->uids; uid && ret; uid = uid->next) {
-        uid_length = mutt_strlen (uid->email);
+        uid_length = str_len (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 128aaa9..2f20bc1 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 = str_len (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 &&
-             safe_strcasecmp (a->subtype, "delivery-status")) {
+             str_casecmp (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 &&
-        !safe_strcasecmp (a->next->subtype, protocol_minor))) {
+        !str_casecmp (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
-      && !safe_strcasecmp (protocol_minor, "pgp-signature"));
+      && !str_casecmp (protocol_minor, "pgp-signature"));
   else if ((WithCrypto & APPLICATION_SMIME)
            && protocol_major == TYPEAPPLICATION
-           && !(safe_strcasecmp (protocol_minor, "x-pkcs7-signature")
-                && safe_strcasecmp (protocol_minor, "pkcs7-signature")));
+           && !(str_casecmp (protocol_minor, "x-pkcs7-signature")
+                && str_casecmp (protocol_minor, "pkcs7-signature")));
   else if (protocol_major == TYPEMULTIPART
-           && !safe_strcasecmp (protocol_minor, "mixed"));
+           && !str_casecmp (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
-              && !safe_strcasecmp (signatures[i]->subtype, "pgp-signature")) {
+              && !str_casecmp (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
               &&
-              (!safe_strcasecmp (signatures[i]->subtype, "x-pkcs7-signature")
-               || !safe_strcasecmp (signatures[i]->subtype,
+              (!str_casecmp (signatures[i]->subtype, "x-pkcs7-signature")
+               || !str_casecmp (signatures[i]->subtype,
                                     "pkcs7-signature"))) {
             if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0)
               goodsig = 0;
index 87d8721..6482b62 100644 (file)
@@ -216,7 +216,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 = str_len (answer_string);
   printw ("%.*s%s", COLS - answer_string_len, msg, answer_string);
   FREE (&answer_string);
 
@@ -401,7 +401,7 @@ int mutt_do_pager (const char *banner,
 {
   int rc;
 
-  if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
+  if (!Pager || str_cmp (Pager, "builtin") == 0)
     rc = mutt_pager (banner, tempfile, do_color, info);
   else {
     char cmd[STRING];
@@ -446,7 +446,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 (str_len (prompt) + 3);
 
     sprintf (pc, "%s: ", prompt);       /* __SPRINTF_CHECKED__ */
     mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
@@ -526,7 +526,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 <= str_len (letters))
           break;
       }
     }
@@ -646,7 +646,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, str_len (s), arboreal);
 }
 
 void mutt_format_s (char *dest,
@@ -671,7 +671,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 = str_len (s);
   mbstate_t mbstate;
 
   memset (&mbstate, 0, sizeof (mbstate));
@@ -695,7 +695,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 str_len except that it returns the width
  * refering to the number of characters cells.
  */
 
@@ -709,7 +709,7 @@ int mutt_strwidth (const char *s)
   if (!s)
     return 0;
 
-  n = mutt_strlen (s);
+  n = str_len (s);
 
   memset (&mbstate, 0, sizeof (mbstate));
   for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) {
index 6943163..3fd4641 100644 (file)
@@ -957,7 +957,7 @@ int mutt_index_menu (void)
           unset_option (OPTHIDEREAD);
         }
         FREE (&Context->pattern);
-        Context->pattern = safe_strdup (buf);
+        Context->pattern = str_dup (buf);
       }
       if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) ||
           mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
@@ -2165,7 +2165,7 @@ int mutt_index_menu (void)
         sleep (2);
       }
       else if (op != OP_FOLLOWUP || !CURHDR->env->followup_to ||
-               safe_strcasecmp (CURHDR->env->followup_to, "poster") ||
+               str_casecmp (CURHDR->env->followup_to, "poster") ||
                query_quadoption (OPT_FOLLOWUPTOPOSTER,
                                  _("Reply by mail as poster prefers?")) !=
                M_YES) {
index 7d238d1..f6455f6 100644 (file)
@@ -78,8 +78,11 @@ the GNU gettext library's developpers.
 Style Guide
 -----------
 
-- global functions should have the prefix "mutt_".  All
-  other functions should be declared "static".
+- global functions outside the library directory should have the prefix
+  "mutt_". All other functions should be declared "static". All global
+  functions defined within the library directory should have the the
+  prefix according to their source file, i.e. "str_" for everything in
+  lib/str.[ch] etc.
 
 - avoid global vars where possible.  If one is required,
   try to contain it to a single source file and declare it
@@ -92,13 +95,11 @@ Style Guide
   in ELM and PINE is the tremendous duplication of code...
   Help keep Mutt small!
 
-- when adding new options, make the old behaviour the
-  default.
+- When adding new options, make the old behaviour the default. Also,
+  add them to UPGRADING in the top-level source directory.
 
 - try to keep Mutt-ng as portable as possible.
 
-- do not use C++-style comments (i.e. "// Comment")
-
 Documentation
 -------------
 
index eb761ad..e08a467 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 str_len (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 (str_len (basename) + 1 > l)
     return -1;
 
   strfcpy (bn, basename, l);
diff --git a/edit.c b/edit.c
index d3818f6..c11cad8 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 = str_len (tmp);
     p = tmp + tmplen;
     tmplen = sizeof (tmp) - tmplen;
   }
@@ -72,10 +72,10 @@ 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 -= str_len (p);
     if (*bufmax == *buflen)
       safe_realloc (&buf, sizeof (char *) * (*bufmax += 25));
-    buf[(*buflen)++] = safe_strdup (tmp);
+    buf[(*buflen)++] = str_dup (tmp);
   }
   if (buf && *bufmax == *buflen) {      /* Do not smash memory past buf */
     safe_realloc (&buf, sizeof (char *) * (++*bufmax));
@@ -155,7 +155,7 @@ static char **be_include_messages (char *msg, char **buf, int *bufmax,
 
       if (*bufmax == *buflen)
         safe_realloc (&buf, sizeof (char *) * (*bufmax += 25));
-      buf[(*buflen)++] = safe_strdup (tmp);
+      buf[(*buflen)++] = str_dup (tmp);
 
       bytes = Context->hdrs[n]->content->length;
       if (inc_hdrs) {
@@ -169,7 +169,7 @@ static char **be_include_messages (char *msg, char **buf, int *bufmax,
 
       if (*bufmax == *buflen)
         safe_realloc (&buf, sizeof (char *) * (*bufmax += 25));
-      buf[(*buflen)++] = safe_strdup ("\n");
+      buf[(*buflen)++] = str_dup ("\n");
     }
     else
       printw (_("%d: invalid message number.\n"), 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 + str_len (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 + str_len (tmp) + 1;
+            snprintf (tmp + str_len (tmp),
+                      sizeof (tmp) - str_len (tmp), " %d",
                       cur->msgno + 1);
           }
           buf = be_include_messages (p, buf, &bufmax, &buflen,
@@ -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[str_len (tmp) - 1] = 0;
           FREE (&buf[buflen]);
           buf[buflen] = NULL;
           continue;
@@ -433,13 +433,13 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur)
         break;
       }
     }
-    else if (mutt_strcmp (".", tmp) == 0)
+    else if (str_cmp (".", tmp) == 0)
       done = 1;
     else {
-      safe_strcat (tmp, sizeof (tmp), "\n");
+      str_cat (tmp, sizeof (tmp), "\n");
       if (buflen == bufmax)
         safe_realloc (&buf, sizeof (char *) * (bufmax += 25));
-      buf[buflen++] = safe_strdup (tmp[1] == '~' ? tmp + 1 : tmp);
+      buf[buflen++] = str_dup (tmp[1] == '~' ? tmp + 1 : tmp);
     }
 
     tmp[0] = 0;
diff --git a/enter.c b/enter.c
index cd98df9..8dac226 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -501,7 +501,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
           goto bye;
         } else if (flags & M_COMMAND) {
           my_wcstombs (buf, buflen, state->wbuf, state->curpos);
-          i = mutt_strlen (buf);
+          i = str_len (buf);
           if (i && buf[i - 1] == '=' &&
               mutt_var_value_complete (buf, buflen, i))
             state->tabs = 0;
@@ -637,7 +637,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
           *numfiles = 1;
           tfiles = safe_calloc (*numfiles, sizeof (char *));
           mutt_expand_path (buf, buflen);
-          tfiles[0] = safe_strdup (buf);
+          tfiles[0] = str_dup (buf);
           *files = tfiles;
         }
         rv = 0;
diff --git a/from.c b/from.c
index e89f409..7b0ed8e 100644 (file)
--- a/from.c
+++ b/from.c
@@ -34,7 +34,7 @@ int mutt_check_month (const char *s)
   int i;
 
   for (i = 0; i < 12; i++)
-    if (safe_strncasecmp (s, Months[i], 3) == 0)
+    if (str_ncasecmp (s, Months[i], 3) == 0)
       return (i);
   return (-1);                  /* error */
 }
@@ -43,10 +43,10 @@ static int is_day_name (const char *s)
 {
   int i;
 
-  if ((mutt_strlen (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
+  if ((str_len (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3)))
     return 0;
   for (i = 0; i < 7; i++)
-    if (safe_strncasecmp (s, Weekdays[i], 3) == 0)
+    if (str_ncasecmp (s, Weekdays[i], 3) == 0)
       return 1;
   return 0;
 }
@@ -65,7 +65,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t * tp)
   if (path)
     *path = 0;
 
-  if (safe_strncmp ("From ", s, 5) != 0)
+  if (str_ncmp ("From ", s, 5) != 0)
     return 0;
 
   s = next_word (s);            /* skip over the From part. */
index 20b270a..ee711cc 100644 (file)
@@ -54,8 +54,8 @@ int getdnsdomainname (char *s, size_t l)
     p = tmp;
     while (ISSPACE (*p))
       p++;
-    if (safe_strncmp ("domain", p, 6) == 0
-        || safe_strncmp ("search", p, 6) == 0) {
+    if (str_ncmp ("domain", p, 6) == 0
+        || str_ncmp ("search", p, 6) == 0) {
       p += 6;
 
       for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n"))
index c0ed056..cf58ab6 100644 (file)
@@ -96,7 +96,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, str_len (buf) < n))
         memcpy (uid, buf, n);
     }
     FREE (&buf);
@@ -130,13 +130,13 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
       {
         debug_print (2, ("record type: %s\n", p));
 
-        if (!mutt_strcmp (p, "pub"));
-        else if (!mutt_strcmp (p, "sub"))
+        if (!str_cmp (p, "pub"));
+        else if (!str_cmp (p, "sub"))
           *is_subkey = 1;
-        else if (!mutt_strcmp (p, "sec"));
-        else if (!mutt_strcmp (p, "ssb"))
+        else if (!str_cmp (p, "sec"));
+        else if (!str_cmp (p, "ssb"))
           *is_subkey = 1;
-        else if (!mutt_strcmp (p, "uid"))
+        else if (!str_cmp (p, "uid"))
           is_uid = 1;
         else
           return NULL;
@@ -248,7 +248,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
 
         uid = safe_calloc (sizeof (pgp_uid_t), 1);
         fix_uid (p);
-        uid->addr = safe_strdup (p);
+        uid->addr = str_dup (p);
         uid->trust = trust;
         uid->flags |= flags;
         uid->parent = k;
index 505fb38..a30ecd4 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -242,7 +242,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 = str_len (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 ((!safe_strncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
+    len -= str_len (tmps);
+    if ((!str_ncmp (tmps, "begin", 5)) && ISSPACE (tmps[5]))
       break;
   }
   while (len > 0) {
     if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL)
       return;
-    len -= mutt_strlen (tmps);
-    if (!safe_strncmp (tmps, "end", 3))
+    len -= str_len (tmps);
+    if (!str_ncmp (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 += str_len (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 += str_len (stte->s->prefix);
       }
       else {
         state_puts ("> ", stte->s);
-        stte->indent_len += mutt_strlen ("> ");
+        stte->indent_len += str_len ("> ");
       }
       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 + str_len (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 += str_len (s->prefix);
   }
 
   while (state != DONE) {
@@ -845,7 +845,7 @@ static void print_flowed_line (char *line, STATE * s, int ql)
 {
   int width;
   char *pos, *oldpos;
-  int len = mutt_strlen (line);
+  int len = str_len (line);
   int i;
 
   if (MaxLineLength > 0) {
@@ -869,7 +869,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 (str_len (line) == 0) {
     if (option (OPTQUOTEEMPTY)) {
       if (s->prefix)
         state_puts(s->prefix,s);
@@ -950,24 +950,24 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
 
   while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
 
-    bytes -= mutt_strlen (buf);
+    bytes -= str_len (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 (str_len (curline) > 0 && curline[str_len (curline) - 1] == ' '
           && newql == quotelevel
           && strcmp (curline + quotelevel, "-- ") != 0) {
         if (buf[newql] == ' ')
-          curline[mutt_strlen (curline) - 1] = '\0';
+          curline[str_len (curline) - 1] = '\0';
 
-        curline = realloc (curline, curline_len + mutt_strlen (buf));
+        curline = realloc (curline, curline_len + str_len (buf));
         if (curline_len == 1)
           *curline = '\0';
-        curline_len += mutt_strlen (buf);
-        safe_strncat (curline, curline_len, buf + newql,
-                      mutt_strlen (buf + newql));
+        curline_len += str_len (buf);
+        str_ncat (curline, curline_len, buf + newql,
+                      str_len (buf + newql));
       }
       else {
         if (first_line) {
@@ -978,11 +978,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 + str_len (buf));
         if (curline_len == 1)
           *curline = '\0';
-        curline_len += mutt_strlen (buf);
-        safe_strncat (curline, curline_len, buf, mutt_strlen (buf));
+        curline_len += str_len (buf);
+        str_ncat (curline, curline_len, buf, str_len (buf));
         quotelevel = newql;
       }
     }
@@ -990,13 +990,13 @@ static void text_plain_flowed_handler (BODY * a, STATE * s)
       /* in case there's no line end it's likely the last line
        * so append to current (if any) */
       if (buf[newql] == ' ')
-        curline[mutt_strlen (curline) - 1] = '\0';
-      curline = realloc (curline, curline_len + mutt_strlen (buf));
+        curline[str_len (curline) - 1] = '\0';
+      curline = realloc (curline, curline_len + str_len (buf));
       if (curline_len == 1)
         *curline = '\0';
-      curline_len += mutt_strlen (buf);
-      safe_strncat (curline, curline_len, buf + newql,
-                    mutt_strlen (buf + newql));
+      curline_len += str_len (buf);
+      str_ncat (curline, curline_len, buf + newql,
+                    str_len (buf + newql));
       break;
     }
   }
@@ -1053,7 +1053,7 @@ static void alternative_handler (BODY * a, STATE * s)
     }
     else {
       wild = 1;
-      btlen = mutt_strlen (t->data);
+      btlen = str_len (t->data);
     }
 
     if (a && a->parts)
@@ -1310,7 +1310,7 @@ void autoview_handler (BODY * a, STATE * s)
   snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
   rfc1524_mailcap_lookup (a, type, entry, M_AUTOVIEW);
 
-  fname = safe_strdup (a->filename);
+  fname = str_dup (a->filename);
   mutt_sanitize_filename (fname, 1);
   rfc1524_expand_filename (entry->nametemplate, fname, tempfile,
                            sizeof (tempfile));
@@ -1602,7 +1602,7 @@ void mutt_body_handler (BODY * b, STATE * s)
         handler = mutt_signed_handler;
     }
     else if ((WithCrypto & APPLICATION_PGP)
-             && safe_strcasecmp ("encrypted", b->subtype) == 0) {
+             && str_casecmp ("encrypted", b->subtype) == 0) {
       p = mutt_get_parameter ("protocol", b->parameter);
 
       if (!p)
diff --git a/hash.c b/hash.c
index f042589..96a97ac 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 = str_cmp (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 (str_cmp (key, ptr->key) == 0)
       return (ptr->data);
   }
   return NULL;
@@ -133,7 +133,7 @@ void hash_delete_hash (HASH * table, int hash, const char *key, const void *data
   struct hash_elem **last = &table->table[hash];
 
   while (ptr) {
-    if ((data == ptr->data || !data) && mutt_strcmp (ptr->key, key) == 0) {
+    if ((data == ptr->data || !data) && str_cmp (ptr->key, key) == 0) {
       *last = ptr->next;
       if (destroy)
         destroy (ptr->data);
index f6e0d8d..7894dcc 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -125,7 +125,7 @@ static unsigned char *dump_char (char *c, unsigned char *d, int *off)
     return d;
   }
 
-  size = mutt_strlen (c) + 1;
+  size = str_len (c) + 1;
   d = dump_int (size, d, off);
   lazy_realloc (&d, *off + size);
   memcpy (d + *off, c, size);
@@ -447,35 +447,35 @@ static int generate_crc32 ()
 
   crc = crc32 (crc, (unsigned char const *)
                "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613",
-               mutt_strlen
+               str_len
                ("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, str_len (Charset));
   crc =
     crc32 (crc, (unsigned char const *) "HAVE_LANGINFO_CODESET",
-           mutt_strlen ("HAVE_LANGINFO_CODESET"));
+           str_len ("HAVE_LANGINFO_CODESET"));
 #endif
 
 #ifdef USE_POP
   crc =
-    crc32 (crc, (unsigned char const *) "USE_POP", mutt_strlen ("USE_POP"));
+    crc32 (crc, (unsigned char const *) "USE_POP", str_len ("USE_POP"));
 #endif
 
 #ifdef MIXMASTER
   crc =
     crc32 (crc, (unsigned char const *) "MIXMASTER",
-           mutt_strlen ("MIXMASTER"));
+           str_len ("MIXMASTER"));
 #endif
 
 #ifdef USE_IMAP
   crc =
-    crc32 (crc, (unsigned char const *) "USE_IMAP", mutt_strlen ("USE_IMAP"));
+    crc32 (crc, (unsigned char const *) "USE_IMAP", str_len ("USE_IMAP"));
 #endif
 
 #ifdef USE_NNTP
   crc =
-    crc32 (crc, (unsigned char const *) "USE_NNTP", mutt_strlen ("USE_NNTP"));
+    crc32 (crc, (unsigned char const *) "USE_NNTP", str_len ("USE_NNTP"));
 #endif
   return crc;
 }
@@ -514,7 +514,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, str_len (folder));
   MD5Final (md5sum, &md5);
 
   ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX,
@@ -593,7 +593,7 @@ HEADER *mutt_hcache_restore (const unsigned char *d, HEADER ** oh)
   /* this is needed for maildir style mailboxes */
   if (oh) {
     h->old = (*oh)->old;
-    h->path = safe_strdup ((*oh)->path);
+    h->path = str_dup ((*oh)->path);
     mutt_free_header (oh);
   }
 
@@ -607,7 +607,7 @@ mutt_hcache_open(const char *path, const char *folder)
   struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE));
   int    flags = VL_OWRITER | VL_OCREAT;
   h->db = NULL;
-  h->folder = safe_strdup(folder);
+  h->folder = str_dup(folder);
   h->crc = generate_crc32();
 
   if (!path || path[0] == '\0')
@@ -660,7 +660,7 @@ mutt_hcache_fetch(void *db, const char *filename,
     return NULL;
 
   strncpy(path, h->folder, sizeof (path));
-  safe_strcat(path, sizeof (path), filename);
+  str_cat(path, sizeof (path), filename);
 
   ksize = strlen(h->folder) + keylen(path + strlen(h->folder));
 
@@ -690,7 +690,7 @@ mutt_hcache_store(void *db, const char *filename, HEADER * header,
     return -1;
 
   strncpy(path, h->folder, sizeof (path));
-  safe_strcat(path, sizeof (path), filename);
+  str_cat(path, sizeof (path), filename);
 
   ksize = strlen(h->folder) + keylen(path + strlen(h->folder));
 
@@ -715,7 +715,7 @@ mutt_hcache_delete(void *db, const char *filename,
     return -1;
 
   strncpy(path, h->folder, sizeof (path));
-  safe_strcat(path, sizeof (path), filename);
+  str_cat(path, sizeof (path), filename);
 
   ksize = strlen(h->folder) + keylen(path + strlen(h->folder));
 
@@ -730,7 +730,7 @@ void *mutt_hcache_open (const char *path, const char *folder)
   int pagesize =
     atoi (HeaderCachePageSize) ? atoi (HeaderCachePageSize) : 16384;
   h->db = NULL;
-  h->folder = safe_strdup (folder);
+  h->folder = str_dup (folder);
   h->crc = generate_crc32 ();
 
   if (!path || path[0] == '\0') {
@@ -785,7 +785,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) - str_len (path));
 
   key.dptr = path;
   key.dsize = keylen (path);
@@ -815,7 +815,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) - str_len (path));
 
   key.dptr = path;
   key.dsize = keylen (path);
@@ -842,7 +842,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) - str_len (path));
 
   key.dptr = path;
   key.dsize = keylen (path);
index f6ad7f7..d6135b3 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] : ' ');
+               str_len (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)) ?
+                                                     str_len (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 && safe_strcasecmp (hdr->env->x_label,
+      if (htmp && str_casecmp (hdr->env->x_label,
                                    htmp->env->x_label) == 0)
         i = 0;
     }
index 1102be8..7348adf 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -150,7 +150,7 @@ void mutt_edit_headers (const char *editor,
           strfcpy (path, p, sizeof (path));
         mutt_expand_path (path, sizeof (path));
         if ((body = mutt_make_file_attach (path))) {
-          body->description = safe_strdup (q);
+          body->description = str_dup (q);
           for (parts = msg->content; parts->next; parts = parts->next);
           parts->next = body;
         }
diff --git a/help.c b/help.c
index 0cc3b74..b9b896a 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 = str_len (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 = str_len (*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, str_len (t1), col_a);
   }
 
   if (ismacro > 0) {
-    if (!mutt_strcmp (Pager, "builtin"))
+    if (!str_cmp (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 (str_len (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 = str_len (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 (str_cmp (Pager, "builtin")) {
           fputc ('\n', f);
           n = 0;
         }
index ba01d51..fba9618 100644 (file)
--- a/history.c
+++ b/history.c
@@ -70,7 +70,7 @@ 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) {
+    if (!h->hist[prev] || str_cmp (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 b77be18..0711ca7 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -88,7 +88,7 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data,
     _mutt_expand_path (path, sizeof (path), 1);
     FREE (&pattern.data);
     memset (&pattern, 0, sizeof (pattern));
-    pattern.data = safe_strdup (path);
+    pattern.data = str_dup (path);
   }
 #ifdef USE_COMPRESSED
   else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK)) {
@@ -107,7 +107,7 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data,
     mutt_check_simple (tmp, sizeof (tmp), DefaultHook);
     FREE (&pattern.data);
     memset (&pattern, 0, sizeof (pattern));
-    pattern.data = safe_strdup (tmp);
+    pattern.data = str_dup (tmp);
   }
 
   if (data & (M_MBOXHOOK | M_SAVEHOOK | M_FCCHOOK)) {
@@ -115,20 +115,20 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data,
     mutt_expand_path (path, sizeof (path));
     FREE (&command.data);
     memset (&command, 0, sizeof (command));
-    command.data = safe_strdup (path);
+    command.data = str_dup (path);
   }
 
   /* 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 && !str_cmp (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 (!str_cmp (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 (str_cmp ("*", buf->data) == 0) {
       if (current_hook_type) {
         snprintf (err->data, err->dsize,
                   _("unhook: Can't do unhook * from within a hook."));
index 448220e..f5af43f 100644 (file)
@@ -53,7 +53,7 @@ int imap_authenticate (IMAP_DATA * idata)
 
   if (ImapAuthenticators && *ImapAuthenticators) {
     /* Try user-specified list of authentication methods */
-    methods = safe_strdup (ImapAuthenticators);
+    methods = str_dup (ImapAuthenticators);
 
     for (method = methods; method; method = delim) {
       delim = strchr (method, ':');
index 3cf9c5f..4a54f48 100644 (file)
@@ -101,8 +101,8 @@ 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_strcat (ibuf, sizeof (ibuf), "\r\n");
+                  str_len (obuf), sizeof (ibuf) - 2);
+  str_cat (ibuf, sizeof (ibuf), "\r\n");
   mutt_socket_write (idata->conn, ibuf);
 
   do
@@ -134,8 +134,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 = str_len (password);
+  chal_len = str_len (challenge);
 
   /* passwords longer than MD5_BLOCK_LEN bytes are substituted with their MD5
    * digests */
index ab99d0d..f80f506 100644 (file)
@@ -60,7 +60,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 = str_len (buf1) + 1;
   maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name,
                               &target_name);
   if (maj_stat != GSS_S_COMPLETE) {
@@ -115,7 +115,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method)
   mutt_to_base64 ((unsigned char *) buf1, send_token.value, send_token.length,
                   sizeof (buf1) - 2);
   gss_release_buffer (&min_stat, &send_token);
-  safe_strcat (buf1, sizeof (buf1), "\r\n");
+  str_cat (buf1, sizeof (buf1), "\r\n");
   mutt_socket_write (idata->conn, buf1);
 
   while (maj_stat == GSS_S_CONTINUE_NEEDED) {
@@ -150,7 +150,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method)
     mutt_to_base64 ((unsigned char *) buf1, send_token.value,
                     send_token.length, sizeof (buf1) - 2);
     gss_release_buffer (&min_stat, &send_token);
-    safe_strcat (buf1, sizeof (buf1), "\r\n");
+    str_cat (buf1, sizeof (buf1), "\r\n");
     mutt_socket_write (idata->conn, buf1);
   }
 
@@ -202,7 +202,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 + str_len (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) {
@@ -213,7 +213,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method)
   mutt_to_base64 ((unsigned char *) buf1, send_token.value, send_token.length,
                   sizeof (buf1) - 2);
   debug_print (2, ("Requesting authorisation as %s\n", idata->conn->account.user));
-  safe_strcat (buf1, sizeof (buf1), "\r\n");
+  str_cat (buf1, sizeof (buf1), "\r\n");
   mutt_socket_write (idata->conn, buf1);
 
   /* Joy of victory or agony of defeat? */
index 21af375..905075a 100644 (file)
@@ -129,10 +129,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, str_len (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, str_len (idata->cmd.buf + 2), buf,
 #endif
                          &len) != SASL_OK) {
         debug_print (1, ("error base64-decoding server response.\n"));
index 6e777c4..30eb5e6 100644 (file)
@@ -76,7 +76,7 @@ int imap_browse (char *path, struct browser_state *state)
   if (!mx.mbox) {
     home_namespace = 1;
     mbox[0] = '\0';             /* Do not replace "" with "INBOX" here */
-    mx.mbox = safe_strdup (ImapHomeNamespace);
+    mx.mbox = str_dup (ImapHomeNamespace);
     if (mutt_bit_isset (idata->capabilities, NAMESPACE)) {
       mutt_message _("Getting namespaces...");
 
@@ -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 = str_len (mbox);
 
     debug_print (3, ("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 = str_len (mbox)) < LONG_STRING - 1) {
             mbox[n++] = idata->delim;
             mbox[n] = '\0';
           }
@@ -130,7 +130,7 @@ int imap_browse (char *path, struct browser_state *state)
       if (!home_namespace)
         showparents = 1;
       imap_qualify_path (buf, sizeof (buf), &mx, mbox);
-      state->folder = safe_strdup (buf);
+      state->folder = str_dup (buf);
       n--;
     }
 
@@ -159,7 +159,7 @@ int imap_browse (char *path, struct browser_state *state)
         ctmp = mbox[n];
         mbox[n] = '\0';
         imap_qualify_path (buf, sizeof (buf), &mx, mbox);
-        state->folder = safe_strdup (buf);
+        state->folder = str_dup (buf);
       }
       mbox[n] = ctmp;
     }
@@ -173,7 +173,7 @@ int imap_browse (char *path, struct browser_state *state)
         imap_add_folder (idata->delim, relpath, 1, 0, state, 1);
       if (!state->folder) {
         imap_qualify_path (buf, sizeof (buf), &mx, relpath);
-        state->folder = safe_strdup (buf);
+        state->folder = str_dup (buf);
       }
     }
   }
@@ -181,7 +181,7 @@ int imap_browse (char *path, struct browser_state *state)
   /* no namespace, no folder: set folder to host only */
   if (!state->folder) {
     imap_qualify_path (buf, sizeof (buf), &mx, NULL);
-    state->folder = safe_strdup (buf);
+    state->folder = str_dup (buf);
   }
 
   if (home_namespace && mbox[0] != '\0') {
@@ -252,7 +252,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 = str_len (buf);
   if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) {
     buf[n++] = idata->delim;
     buf[n] = '\0';
@@ -261,7 +261,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 (!str_len (buf)) {
     mutt_error (_("Mailbox must have a name."));
     mutt_sleep (1);
     goto fail;
@@ -304,7 +304,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 (!str_len (newname)) {
     mutt_error (_("Mailbox must have a name."));
     mutt_sleep (1);
     goto fail;
@@ -355,7 +355,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd,
       if (isparent)
         noselect = 1;
       /* prune current folder from output */
-      if (isparent || safe_strncmp (name, mx.mbox, mutt_strlen (name)))
+      if (isparent || str_ncmp (name, mx.mbox, str_len (name)))
         imap_add_folder (idata->delim, name, noselect, noinferiors, state,
                          isparent);
     }
@@ -393,8 +393,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 (!safe_strncmp (mx.mbox, folder, mutt_strlen (mx.mbox)))
-    strfcpy (relpath, folder + mutt_strlen (mx.mbox), sizeof (relpath));
+  else if (!str_ncmp (mx.mbox, folder, str_len (mx.mbox)))
+    strfcpy (relpath, folder + str_len (mx.mbox), sizeof (relpath));
   else
     strfcpy (relpath, folder, sizeof (relpath));
 
@@ -407,15 +407,15 @@ static void imap_add_folder (char delim, char *folder, int noselect,
   }
 
   imap_qualify_path (tmp, sizeof (tmp), &mx, folder);
-  (state->entry)[state->entrylen].name = safe_strdup (tmp);
+  (state->entry)[state->entrylen].name = str_dup (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 && str_len (relpath) < sizeof (relpath) - 1) {
+    relpath[str_len (relpath) + 1] = '\0';
+    relpath[str_len (relpath)] = delim;
   }
 
-  (state->entry)[state->entrylen].desc = safe_strdup (relpath);
+  (state->entry)[state->entrylen].desc = str_dup (relpath);
 
   (state->entry)[state->entrylen].imap = 1;
   /* delimiter at the root is useless. */
@@ -431,7 +431,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 str_cmp (a->name, b->name);
 }
 
 static int browse_get_namespace (IMAP_DATA * idata, char *nsbuf, int nsblen,
index 40a1cf3..ebf468e 100644 (file)
@@ -70,7 +70,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 = str_len (idata->cmd.seq) + str_len (cmd) + 4;
   out = (char *) safe_malloc (outlen);
   snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
 
@@ -182,7 +182,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 = str_len (idata->cmd.seq) + str_len (cmd) + 4;
   out = (char *) safe_malloc (outlen);
   snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd);
 
@@ -395,7 +395,7 @@ static void cmd_parse_capabilities (IMAP_DATA * idata, char *s)
 
   s = imap_next_word (s);
   FREE (&idata->capstr);
-  idata->capstr = safe_strdup (s);
+  idata->capstr = str_dup (s);
 
   memset (idata->capabilities, 0, sizeof (idata->capabilities));
 
index 202a10d..0abf32b 100644 (file)
@@ -550,11 +550,11 @@ int imap_open_mailbox (CONTEXT * ctx)
   /* Clean up path and replace the one in the ctx */
   imap_fix_path (idata, mx.mbox, buf, sizeof (buf));
   FREE (&(idata->mailbox));
-  idata->mailbox = safe_strdup (buf);
+  idata->mailbox = str_dup (buf);
   imap_qualify_path (buf, sizeof (buf), &mx, idata->mailbox);
 
   FREE (&(ctx->path));
-  ctx->path = safe_strdup (buf);
+  ctx->path = str_dup (buf);
 
   idata->ctx = ctx;
 
@@ -781,7 +781,7 @@ static void imap_set_flag (IMAP_DATA * idata, int aclbit, int flag,
 {
   if (mutt_bit_isset (idata->rights, aclbit))
     if (flag)
-      safe_strcat (flags, flsize, str);
+      str_cat (flags, flsize, str);
 }
 
 /* imap_make_msg_set: make an IMAP4rev1 UID message set out of a set of
@@ -1170,9 +1170,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 (str_cmp (mbox_unquoted, idata->mailbox) == 0
       || (ascii_strcasecmp (mbox_unquoted, "INBOX") == 0
-          && safe_strcasecmp (mbox_unquoted, idata->mailbox) == 0)) {
+          && str_casecmp (mbox_unquoted, idata->mailbox) == 0)) {
     strfcpy (buf, "NOOP", sizeof (buf));
   }
   else if (mutt_bit_isset (idata->capabilities, IMAP4REV1) ||
@@ -1197,8 +1197,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 (safe_strncmp (mbox_unquoted, s, mutt_strlen (mbox_unquoted)) == 0
-          || safe_strncmp (mbox, s, mutt_strlen (mbox)) == 0) {
+      if (str_ncmp (mbox_unquoted, s, str_len (mbox_unquoted)) == 0
+          || str_ncmp (mbox, s, str_len (mbox)) == 0) {
         s = imap_next_word (s);
         s = imap_next_word (s);
         if (isdigit ((unsigned char) *s)) {
@@ -1353,12 +1353,12 @@ static int imap_complete_hosts (char *dest, size_t len) {
   int matchlen;
   int i = 0;
 
-  matchlen = mutt_strlen (dest);
+  matchlen = str_len (dest);
   if (list_empty (Incoming))
     return (-1);
   for (i = 0; i < Incoming->length; i++) {
     mailbox = (BUFFY*) Incoming->data[i];
-    if (!safe_strncmp (dest, mailbox->path, matchlen)) {
+    if (!str_ncmp (dest, mailbox->path, matchlen)) {
       if (rc) {
         strfcpy (dest, mailbox->path, len);
         rc = 0;
@@ -1379,7 +1379,7 @@ static int imap_complete_hosts (char *dest, size_t len) {
     url.user = NULL;
     url.path = NULL;
     url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0);
-    if (!safe_strncmp (dest, urlstr, matchlen)) {
+    if (!str_ncmp (dest, urlstr, matchlen)) {
       if (rc) {
         strfcpy (dest, urlstr, len);
         rc = 0;
@@ -1447,14 +1447,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 = str_len (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 = str_len (completion);
         completions++;
         continue;
       }
index 6e6314d..e09ec4e 100644 (file)
@@ -349,7 +349,7 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
 
   cache->uid = HEADER_DATA (h)->uid;
   mutt_mktemp (path);
-  cache->path = safe_strdup (path);
+  cache->path = str_dup (path);
   if (!(msg->fp = safe_fopen (path, "w+"))) {
     FREE (&cache->path);
     return -1;
@@ -754,8 +754,8 @@ void imap_add_keywords (char *s, HEADER * h, LIST * mailbox_flags,
 
   while (keywords) {
     if (msg_has_flag (mailbox_flags, keywords->data)) {
-      safe_strcat (s, slen, keywords->data);
-      safe_strcat (s, slen, " ");
+      str_cat (s, slen, keywords->data);
+      str_cat (s, slen, " ");
     }
     keywords = keywords->next;
   }
@@ -878,7 +878,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 str_len (fn);
 }
 
 /* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER.
@@ -934,7 +934,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, str_len (flag_list->data)))
       return 1;
 
     flag_list = flag_list->next;
index 4ad4bbb..cf04c19 100644 (file)
@@ -42,7 +42,7 @@ static int imap_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr)
     mutt_perror (tmp);
     return (-1);
   }
-  msg->path = safe_strdup (tmp);
+  msg->path = str_dup (tmp);
   return 0;
 }
 
index bc5571a..589a661 100644 (file)
@@ -232,10 +232,10 @@ bail:
 void imap_utf7_encode (char **s)
 {
   if (Charset) {
-    char *t = safe_strdup (*s);
+    char *t = str_dup (*s);
 
     if (!mutt_convert_string (&t, Charset, "UTF-8", 0))
-      utf8_to_utf7 (t, mutt_strlen (t), s, 0);
+      utf8_to_utf7 (t, str_len (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, str_len (*s), 0, 0);
 
     if (t && !mutt_convert_string (&t, "UTF-8", Charset, 0)) {
       FREE (s);
index 5163da7..0e842b1 100644 (file)
@@ -94,7 +94,7 @@ int imap_parse_path (const char *path, IMAP_MBOX * mx)
   mx->account.port = ImapPort;
   mx->account.type = M_ACCT_TYPE_IMAP;
 
-  c = safe_strdup (path);
+  c = str_dup (path);
   url_parse_ciss (&url, c);
 
   if (!(url.scheme == U_IMAP || url.scheme == U_IMAPS) ||
@@ -103,7 +103,7 @@ int imap_parse_path (const char *path, IMAP_MBOX * mx)
     return -1;
   }
 
-  mx->mbox = safe_strdup (url.path);
+  mx->mbox = str_dup (url.path);
 
   if (url.scheme == U_IMAPS)
     mx->account.flags |= M_ACCT_SSL;
@@ -130,12 +130,12 @@ void imap_pretty_mailbox (char *path)
   if (imap_parse_path (path, &target) < 0)
     return;
 
-  tlen = mutt_strlen (target.mbox);
+  tlen = str_len (target.mbox);
   /* check whether we can do '=' substitution */
   if (mx_get_magic (Maildir) == M_IMAP && !imap_parse_path (Maildir, &home)) {
-    hlen = mutt_strlen (home.mbox);
+    hlen = str_len (home.mbox);
     if (tlen && mutt_account_match (&home.account, &target.account) &&
-        !safe_strncmp (home.mbox, target.mbox, hlen)) {
+        !str_ncmp (home.mbox, target.mbox, hlen)) {
       if (!hlen)
         home_match = 1;
       else
@@ -424,7 +424,7 @@ void imap_munge_mbox_name (char *dest, size_t dlen, const char *src)
 {
   char *buf;
 
-  buf = safe_strdup (src);
+  buf = str_dup (src);
   imap_utf7_encode (&buf);
 
   imap_quote_string (dest, dlen, buf);
@@ -438,10 +438,10 @@ void imap_unmunge_mbox_name (char *s)
 
   imap_unquote_string (s);
 
-  buf = safe_strdup (s);
+  buf = str_dup (s);
   if (buf) {
     imap_utf7_decode (&buf);
-    strncpy (s, buf, mutt_strlen (s));
+    strncpy (s, buf, str_len (s));
   }
 
   FREE (&buf);
diff --git a/init.c b/init.c
index 3613ae6..ff8c03b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -61,7 +61,7 @@ int CurRCLine = 0;
 /* for synonym warning reports: adds synonym to end of list */
 static void syn_add (int n, int o) {
   syn_t* tmp = safe_malloc (sizeof (syn_t));
-  tmp->f = safe_strdup (CurRCFile);
+  tmp->f = str_dup (CurRCFile);
   tmp->l = CurRCLine;
   tmp->n = n;
   tmp->o = o;
@@ -124,7 +124,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 (str_cmp (s, MuttVars[i].option) == 0) {
       if (MuttVars[i].type == DT_SYN)
         syn_add (mutt_option_index ((char *) MuttVars[i].data), i);
       return (MuttVars[i].type ==
@@ -260,8 +260,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 = str_len (expn.data);
+        tok->dsize = expnlen + str_len (tok->dptr) + 1;
         ptr = safe_malloc (tok->dsize);
         memcpy (ptr, expn.data, expnlen);
         strcpy (ptr + expnlen, tok->dptr);      /* __STRCPY_CHECKED__ */
@@ -324,7 +324,7 @@ static void add_to_list (LIST ** list, const char *str)
 
   if (!*list || last) {
     t = (LIST *) safe_calloc (1, sizeof (LIST));
-    t->data = safe_strdup (str);
+    t->data = str_dup (str);
     if (last) {
       last->next = t;
       last = last->next;
@@ -402,7 +402,7 @@ static int add_to_spam_list (SPAM_LIST ** list, const char *pat,
   }
 
   /* Now t is the SPAM_LIST* that we want to modify. It is prepared. */
-  t->template = safe_strdup (templ);
+  t->template = str_dup (templ);
 
   /* Find highest match number in template string */
   t->nmatch = 0;
@@ -431,7 +431,7 @@ static int remove_from_spam_list (SPAM_LIST ** list, const char *pat)
   spam = *list;
   if (!spam)
     return 0;
-  if (spam->rx && !mutt_strcmp (spam->rx->pattern, pat)) {
+  if (spam->rx && !str_cmp (spam->rx->pattern, pat)) {
     *list = spam->next;
     rx_free (&spam->rx);
     FREE(&spam->template);
@@ -441,7 +441,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 (!str_cmp (spam->rx->pattern, pat)) {
       prev->next = spam->next;
       rx_free (&spam->rx);
       FREE(spam->template);
@@ -461,7 +461,7 @@ static void remove_from_list (LIST ** l, const char *str)
 {
   LIST *p, *last = NULL;
 
-  if (mutt_strcmp ("*", str) == 0)
+  if (str_cmp ("*", str) == 0)
     mutt_free_list (l);         /* ``unCMD *'' means delete all current entries */
   else {
     p = *l;
@@ -487,7 +487,7 @@ static int remove_from_rx_list (list2_t** l, const char *str)
 {
   int i = 0;
 
-  if (mutt_strcmp ("*", str) == 0) {
+  if (str_cmp ("*", str) == 0) {
     list_del (l, (list_del_t*) rx_free);
     return (0);
   }
@@ -520,8 +520,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, str_len (tmp->data))
+            && (str_len (b[j].name) == str_len (tmp->data))) {
           res = 1;
           break;
         }
@@ -531,13 +531,13 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data,
     char *p = NULL;
 
     i = 0;
-    j = mutt_strlen (tmp->data);
+    j = str_len (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 (str_len (Features[i].name) == j &&
             ascii_strncasecmp (Features[i].name, p, j)) {
           res = 1;
           break;
@@ -643,7 +643,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 (str_cmp (buf->data, "*") &&
         add_to_rx_list (&UnAlternates, buf->data, REG_ICASE, err) != 0)
       return -1;
 
@@ -699,7 +699,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 (!str_cmp (buf->data, "*")) {
       mutt_free_spam_list (&SpamList);
       list_del (&NoSpamList, (list_del_t*) rx_free);
       return 0;
@@ -729,7 +729,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 (str_cmp (buf->data, "*") == 0) {
       mutt_free_list ((LIST **) data);
       break;
     }
@@ -763,7 +763,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 (str_cmp (buf->data, "*") &&
         add_to_rx_list (&UnMailLists, buf->data, REG_ICASE, err) != 0)
       return -1;
   }
@@ -797,7 +797,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 (str_cmp (buf->data, "*") &&
         add_to_rx_list (&UnSubscribedLists, buf->data, REG_ICASE, err) != 0)
       return -1;
   }
@@ -814,7 +814,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 (str_cmp ("*", buf->data) == 0) {
       if (CurrentMenu == MENU_ALIAS) {
         for (tmp = Aliases; tmp; tmp = tmp->next)
           tmp->del = 1;
@@ -826,7 +826,7 @@ static int parse_unalias (BUFFER * buf, BUFFER * s, unsigned long data,
     }
     else
       for (tmp = Aliases; tmp; tmp = tmp->next) {
-        if (safe_strcasecmp (buf->data, tmp->name) == 0) {
+        if (str_casecmp (buf->data, tmp->name) == 0) {
           if (CurrentMenu == MENU_ALIAS) {
             tmp->del = 1;
             set_option (OPTFORCEREDRAWINDEX);
@@ -866,7 +866,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 (!safe_strcasecmp (tmp->name, buf->data))
+    if (!str_casecmp (tmp->name, buf->data))
       break;
     last = tmp;
   }
@@ -875,7 +875,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s, unsigned long data,
     /* create a new alias */
     tmp = (ALIAS *) safe_calloc (1, sizeof (ALIAS));
     tmp->self = tmp;
-    tmp->name = safe_strdup (buf->data);
+    tmp->name = str_dup (buf->data);
     /* give the main addressbook code a chance */
     if (CurrentMenu == MENU_ALIAS)
       set_option (OPTMENUCALLER);
@@ -925,13 +925,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 (str_cmp ("*", buf->data) == 0)
       mutt_free_list (&UserHeader);
     else {
       tmp = UserHeader;
       last = NULL;
 
-      l = mutt_strlen (buf->data);
+      l = str_len (buf->data);
       if (buf->data[l - 1] == ':')
         l--;
 
@@ -1003,12 +1003,12 @@ parse_sort (short *val, const char *s, const struct mapping_t *map,
 {
   int i, flags = 0;
 
-  if (safe_strncmp ("reverse-", s, 8) == 0) {
+  if (str_ncmp ("reverse-", s, 8) == 0) {
     s += 8;
     flags = SORT_REVERSE;
   }
 
-  if (safe_strncmp ("last-", s, 5) == 0) {
+  if (str_ncmp ("last-", s, 5) == 0) {
     s += 5;
     flags |= SORT_LAST;
   }
@@ -1028,11 +1028,11 @@ static void mutt_set_default (struct option_t *p)
   switch (p->type & DT_MASK) {
   case DT_STR:
     if (!p->init && *((char **) p->data))
-      p->init = (unsigned long) safe_strdup (*((char **) p->data));
+      p->init = (unsigned long) str_dup (*((char **) p->data));
     break;
   case DT_PATH:
     if (!p->init && *((char **) p->data)) {
-      char *cp = safe_strdup (*((char **) p->data));
+      char *cp = str_dup (*((char **) p->data));
 
       /* mutt_pretty_mailbox (cp); */
       p->init = (unsigned long) cp;
@@ -1044,7 +1044,7 @@ static void mutt_set_default (struct option_t *p)
 
       *tmp = '\0';
       rfc822_write_address (tmp, sizeof (tmp), *((ADDRESS **) p->data), 0);
-      p->init = (unsigned long) safe_strdup (tmp);
+      p->init = (unsigned long) str_dup (tmp);
     }
     break;
   case DT_RX:
@@ -1052,7 +1052,7 @@ static void mutt_set_default (struct option_t *p)
       rx_t* pp = (rx_t*) p->data;
 
       if (!p->init && pp->pattern)
-        p->init = (unsigned long) safe_strdup (pp->pattern);
+        p->init = (unsigned long) str_dup (pp->pattern);
       break;
     }
   }
@@ -1109,9 +1109,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 (str_cmp (p->option, "mask") != 0)
           flags |= mutt_which_case ((const char *) p->init);
-        if (mutt_strcmp (p->option, "mask") == 0 && *s == '!') {
+        if (str_cmp (p->option, "mask") == 0 && *s == '!') {
           s++;
           pp->not = 1;
         }
@@ -1161,11 +1161,11 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
       query = 1;
       s->dptr++;
     }
-    else if (safe_strncmp ("no", s->dptr, 2) == 0) {
+    else if (str_ncmp ("no", s->dptr, 2) == 0) {
       s->dptr += 2;
       unset = !unset;
     }
-    else if (safe_strncmp ("inv", s->dptr, 3) == 0) {
+    else if (str_ncmp ("inv", s->dptr, 3) == 0) {
       s->dptr += 3;
       inv = !inv;
     }
@@ -1178,7 +1178,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 && !str_cmp ("all", tmp->data))) {
       snprintf (err->data, err->dsize, _("%s: unknown variable"), tmp->data);
       return (-1);
     }
@@ -1195,7 +1195,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
         return (-1);
       }
 
-      if (!mutt_strcmp ("all", tmp->data)) {
+      if (!str_cmp ("all", tmp->data)) {
         for (idx = 0; MuttVars[idx].option; idx++)
           mutt_restore_default (&MuttVars[idx]);
         return 0;
@@ -1275,11 +1275,11 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
         if (DTYPE (MuttVars[idx].type) == DT_PATH) {
           strfcpy (scratch, tmp->data, sizeof (scratch));
           mutt_expand_path (scratch, sizeof (scratch));
-          *((char **) MuttVars[idx].data) = safe_strdup (scratch);
+          *((char **) MuttVars[idx].data) = str_dup (scratch);
         }
         else if (DTYPE (MuttVars[idx].type) == DT_STR) {
-          *((char **) MuttVars[idx].data) = safe_strdup (tmp->data);
-          if (mutt_strcmp (MuttVars[idx].option, "charset") == 0)
+          *((char **) MuttVars[idx].data) = str_dup (tmp->data);
+          if (str_cmp (MuttVars[idx].option, "charset") == 0)
             mutt_set_charset (Charset);
         }
         else {
@@ -1301,7 +1301,7 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
       }
 
       if (option (OPTATTACHMSG)
-          && !mutt_strcmp (MuttVars[idx].option, "reply_regexp")) {
+          && !str_cmp (MuttVars[idx].option, "reply_regexp")) {
         snprintf (err->data, err->dsize,
                   "Operation not permitted when in attach-message mode.");
         r = -1;
@@ -1313,15 +1313,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 || str_cmp (ptr->pattern, tmp->data) != 0) {
         int not = 0;
 
         /* $mask is case-sensitive */
-        if (mutt_strcmp (MuttVars[idx].option, "mask") != 0)
+        if (str_cmp (MuttVars[idx].option, "mask") != 0)
           flags |= mutt_which_case (tmp->data);
 
         p = tmp->data;
-        if (mutt_strcmp (MuttVars[idx].option, "mask") == 0) {
+        if (str_cmp (MuttVars[idx].option, "mask") == 0) {
           if (*p == '!') {
             not = 1;
             p++;
@@ -1343,14 +1343,14 @@ static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
           FREE (&ptr->rx);
         }
 
-        ptr->pattern = safe_strdup (tmp->data);
+        ptr->pattern = str_dup (tmp->data);
         ptr->rx = rx;
         ptr->not = not;
 
         /* $reply_regexp and $alterantes require special treatment */
 
         if (Context && Context->msgcount &&
-            mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0) {
+            str_cmp (MuttVars[idx].option, "reply_regexp") == 0) {
           regmatch_t pmatch[1];
           int i;
 
@@ -1426,12 +1426,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 (str_cmp (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 (str_cmp (MuttVars[idx].option, "pager_index_lines") == 0) {
         if (*ptr < 0)
           *ptr = 0;
       }
@@ -1572,7 +1572,7 @@ static int source_rc (const char *rcfile, BUFFER * err)
     CurRCLine++;
     conv = ConfigCharset && (*ConfigCharset) && Charset;
     if (conv) {
-      currentline = safe_strdup (linebuf);
+      currentline = str_dup (linebuf);
       if (!currentline)
         continue;
       mutt_convert_string (&currentline, ConfigCharset, Charset, 0);
@@ -1652,7 +1652,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 = str_len (line);
 
   *err->data = 0;
 
@@ -1666,7 +1666,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 (!str_cmp (token->data, Commands[i].name)) {
         if (Commands[i].func (token, &expn, Commands[i].data, err) != 0)
           goto finish;
         break;
@@ -1764,18 +1764,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 (!safe_strncmp (buffer, "set", 3)
-           || !safe_strncmp (buffer, "unset", 5)
-           || !safe_strncmp (buffer, "reset", 5)
-           || !safe_strncmp (buffer, "toggle", 6)) {    /* complete variables */
+  else if (!str_ncmp (buffer, "set", 3)
+           || !str_ncmp (buffer, "unset", 5)
+           || !str_ncmp (buffer, "reset", 5)
+           || !str_ncmp (buffer, "toggle", 6)) {    /* complete variables */
     char *prefixes[] = { "no", "inv", "?", "&", 0 };
 
     pt++;
     /* loop through all the possible prefixes (no, inv, ...) */
-    if (!safe_strncmp (buffer, "set", 3)) {
+    if (!str_ncmp (buffer, "set", 3)) {
       for (num = 0; prefixes[num]; num++) {
-        if (!safe_strncmp (pt, prefixes[num], mutt_strlen (prefixes[num]))) {
-          pt += mutt_strlen (prefixes[num]);
+        if (!str_ncmp (pt, prefixes[num], str_len (prefixes[num]))) {
+          pt += str_len (prefixes[num]);
           break;
         }
       }
@@ -1812,7 +1812,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
 
     strncpy (pt, Completed, buffer + len - pt - spaces);
   }
-  else if (!safe_strncmp (buffer, "exec", 4)) {
+  else if (!str_ncmp (buffer, "exec", 4)) {
     struct binding_t *menu = km_get_table (CurrentMenu);
 
     if (!menu && CurrentMenu != MENU_PAGER)
@@ -1880,12 +1880,12 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
   if (*pt == '=')               /* abort if no var before the '=' */
     return 0;
 
-  if (safe_strncmp (buffer, "set", 3) == 0) {
+  if (str_ncmp (buffer, "set", 3) == 0) {
     int idx;
 
     strfcpy (var, pt, sizeof (var));
     /* ignore the trailing '=' when comparing */
-    var[mutt_strlen (var) - 1] = 0;
+    var[str_len (var) - 1] = 0;
     if ((idx = mutt_option_index (var)) == -1)
       return 0;                 /* no such variable. */
     else {
@@ -2074,18 +2074,18 @@ void mutt_init (int skip_sys_rc, LIST * commands)
   /* on one of the systems I use, getcwd() does not return the same prefix
      as is listed in the passwd file */
   if ((p = getenv ("HOME")))
-    Homedir = safe_strdup (p);
+    Homedir = str_dup (p);
 
   /* Get some information about the user */
   if ((pw = getpwuid (getuid ()))) {
     char rnbuf[STRING];
 
-    Username = safe_strdup (pw->pw_name);
+    Username = str_dup (pw->pw_name);
     if (!Homedir)
-      Homedir = safe_strdup (pw->pw_dir);
+      Homedir = str_dup (pw->pw_dir);
 
-    Realname = safe_strdup (mutt_gecos_name (rnbuf, sizeof (rnbuf), pw));
-    Shell = safe_strdup (pw->pw_shell);
+    Realname = str_dup (mutt_gecos_name (rnbuf, sizeof (rnbuf), pw));
+    Shell = str_dup (pw->pw_shell);
   }
   else {
     if (!Homedir) {
@@ -2094,13 +2094,13 @@ void mutt_init (int skip_sys_rc, LIST * commands)
       exit (1);
     }
     if ((p = getenv ("USER")))
-      Username = safe_strdup (p);
+      Username = str_dup (p);
     else {
       mutt_endwin (NULL);
       fputs (_("unable to determine username"), stderr);
       exit (1);
     }
-    Shell = safe_strdup ((p = getenv ("SHELL")) ? p : "/bin/sh");
+    Shell = str_dup ((p = getenv ("SHELL")) ? p : "/bin/sh");
   }
 
   debug_start(Homedir);
@@ -2114,20 +2114,20 @@ void mutt_init (int skip_sys_rc, LIST * commands)
     strfcpy (buffer, p, sizeof (buffer));       /* save the domain for below */
   }
   else
-    Hostname = safe_strdup (utsname.nodename);
+    Hostname = str_dup (utsname.nodename);
 
 #ifndef DOMAIN
 #define DOMAIN buffer
   if (!p && getdnsdomainname (buffer, sizeof (buffer)) == -1)
-    Fqdn = safe_strdup ("@");
+    Fqdn = str_dup ("@");
   else
 #endif /* DOMAIN */
   if (*DOMAIN != '@') {
-    Fqdn = safe_malloc (mutt_strlen (DOMAIN) + mutt_strlen (Hostname) + 2);
+    Fqdn = safe_malloc (str_len (DOMAIN) + str_len (Hostname) + 2);
     sprintf (Fqdn, "%s.%s", NONULL (Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */
   }
   else
-    Fqdn = safe_strdup (NONULL (Hostname));
+    Fqdn = str_dup (NONULL (Hostname));
 
 #ifdef USE_NNTP
   {
@@ -2144,37 +2144,37 @@ void mutt_init (int skip_sys_rc, LIST * commands)
              && (*i != '\n'))
         i++;
       *i = '\0';
-      NewsServer = safe_strdup (p);
+      NewsServer = str_dup (p);
       fclose (f);
     }
   }
   if ((p = getenv ("NNTPSERVER")))
-    NewsServer = safe_strdup (p);
+    NewsServer = str_dup (p);
 #endif
 
   if ((p = getenv ("MAIL")))
-    Spoolfile = safe_strdup (p);
+    Spoolfile = str_dup (p);
   else if ((p = getenv ("MAILDIR")))
-    Spoolfile = safe_strdup (p);
+    Spoolfile = str_dup (p);
   else {
 #ifdef HOMESPOOL
     mutt_concat_path (buffer, NONULL (Homedir), MAILPATH, sizeof (buffer));
 #else
     mutt_concat_path (buffer, MAILPATH, NONULL (Username), sizeof (buffer));
 #endif
-    Spoolfile = safe_strdup (buffer);
+    Spoolfile = str_dup (buffer);
   }
 
   if ((p = getenv ("MAILCAPS")))
-    MailcapPath = safe_strdup (p);
+    MailcapPath = str_dup (p);
   else {
     /* Default search path from RFC1524 */
     MailcapPath =
-      safe_strdup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR
+      str_dup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR
                    "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
   }
 
-  Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");
+  Tempdir = str_dup ((p = getenv ("TMPDIR")) ? p : "/tmp");
 
   p = getenv ("VISUAL");
   if (!p) {
@@ -2182,8 +2182,8 @@ void mutt_init (int skip_sys_rc, LIST * commands)
     if (!p)
       p = "vi";
   }
-  Editor = safe_strdup (p);
-  Visual = safe_strdup (p);
+  Editor = str_dup (p);
+  Visual = str_dup (p);
 
   if ((p = getenv ("REPLYTO")) != NULL) {
     BUFFER buf, token;
@@ -2192,7 +2192,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 = str_len (buffer);
 
     memset (&token, 0, sizeof (token));
     parse_my_hdr (&token, &buf, 0, &err);
@@ -2260,16 +2260,16 @@ void mutt_init (int skip_sys_rc, LIST * commands)
                 NONULL (Homedir));
 
     default_rc = 1;
-    Muttrc = safe_strdup (buffer);
+    Muttrc = str_dup (buffer);
   }
   else {
     strfcpy (buffer, Muttrc, sizeof (buffer));
     FREE (&Muttrc);
     mutt_expand_path (buffer, sizeof (buffer));
-    Muttrc = safe_strdup (buffer);
+    Muttrc = str_dup (buffer);
   }
   FREE (&AliasFile);
-  AliasFile = safe_strdup (NONULL (Muttrc));
+  AliasFile = str_dup (NONULL (Muttrc));
 
   /* Process the global rc file if it exists and the user hasn't explicity
      requested not to via "-n".  */
@@ -2350,7 +2350,7 @@ int mutt_get_hook_type (const char *name)
 }
 
 static int opt_cmp (const void* a, const void* b) {
-  return (mutt_strcmp ((*(struct option_t**) a)->option,
+  return (str_cmp ((*(struct option_t**) a)->option,
                        (*(struct option_t**) b)->option));
 }
 
index 6f71eda..9db65e9 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -189,8 +189,8 @@ void km_bind (char *s, int menu, int op, char *macro, char *descr)
 
   map = allocKeys (len, buf);
   map->op = op;
-  map->macro = safe_strdup (macro);
-  map->descr = safe_strdup (descr);
+  map->macro = str_dup (macro);
+  map->descr = str_dup (descr);
 
   tmp = Keymaps[menu];
 
@@ -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)
+        str_len (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 + str_len (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 = str_len (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 (str_cmp (func, bindings[i].name) == 0) {
       km_bindkey (key, menu, bindings[i].op);
       return (0);
     }
@@ -832,7 +832,7 @@ int mutt_parse_macro (BUFFER * buf, BUFFER * s, unsigned long data,
   }
   else {
     if (MoreArgs (s)) {
-      seq = safe_strdup (buf->data);
+      seq = str_dup (buf->data);
       mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
 
       if (MoreArgs (s)) {
@@ -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, str_len (function));
     if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
-      ops[nops] = get_op (OpGeneric, function, mutt_strlen (function));
+      ops[nops] = get_op (OpGeneric, function, str_len (function));
 
     if (ops[nops] == OP_NULL) {
       mutt_flushinp ();
diff --git a/lib.c b/lib.c
index 096f57f..d9900aa 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -217,7 +217,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 >
+        (str_len (abs_oldpath) + 1 + str_len (oldpath) + 1 >
          sizeof abs_oldpath))
       return -1;
 
@@ -478,7 +478,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[str_len (dir) - 1] == '/'))
     fmt = "%s%s";
 
   snprintf (d, l, fmt, dir, fname);
index 168a3fe..e7c4f3c 100644 (file)
--- a/lib/rx.c
+++ b/lib/rx.c
@@ -16,7 +16,7 @@
 rx_t *rx_compile (const char *s, int flags) {
   rx_t *pp = safe_calloc (1, sizeof (rx_t));
 
-  pp->pattern = safe_strdup (s);
+  pp->pattern = str_dup (s);
   pp->rx = safe_calloc (1, sizeof (regex_t));
   if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
     rx_free (&pp);
@@ -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 (str_cmp (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 (str_cmp (((rx_t*) l->data[i])->pattern, pat) == 0)
       return (i);
   return (-1);
 }
index 0db2b6e..76eb248 100644 (file)
--- a/lib/str.c
+++ b/lib/str.c
 
 #include "mem.h"
 
-char *safe_strdup (const char *s)
+char *str_dup (const char *s)
 {
   char *p;
   size_t l;
 
   if (!s || !*s)
     return 0;
-  l = mutt_strlen (s) + 1;
+  l = str_len (s) + 1;
   p = (char *) safe_malloc (l);
   memcpy (p, s, l);
   return (p);
 }
 
-char *safe_strcat (char *d, size_t l, const char *s)
+char *str_cat (char *d, size_t l, const char *s)
 {
   char *p = d;
 
@@ -48,7 +48,7 @@ char *safe_strcat (char *d, size_t l, const char *s)
   return p;
 }
 
-char *safe_strncat (char *d, size_t l, const char *s, size_t sl)
+char *str_ncat (char *d, size_t l, const char *s, size_t sl)
 {
   char *p = d;
 
@@ -67,32 +67,32 @@ char *safe_strncat (char *d, size_t l, const char *s, size_t sl)
   return p;
 }
 
-int mutt_strcmp (const char *a, const char *b)
+int str_cmp (const char *a, const char *b)
 {
   return strcmp (NONULL (a), NONULL (b));
 }
 
-int safe_strcasecmp (const char *a, const char *b)
+int str_casecmp (const char *a, const char *b)
 {
   return strcasecmp (NONULL (a), NONULL (b));
 }
 
-int safe_strncmp (const char *a, const char *b, size_t l)
+int str_ncmp (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)
+int str_ncasecmp (const char *a, const char *b, size_t l)
 {
   return strncasecmp (NONULL (a), NONULL (b), l);
 }
 
-size_t mutt_strlen (const char *a)
+size_t str_len (const char *a)
 {
   return a ? strlen (a) : 0;
 }
 
-int safe_strcoll (const char *a, const char *b)
+int str_coll (const char *a, const char *b)
 {
   return strcoll (NONULL (a), NONULL (b));
 }
@@ -100,14 +100,14 @@ int safe_strcoll (const char *a, const char *b)
 void str_replace (char **p, const char *s)
 {
   FREE (p);
-  *p = safe_strdup (s);
+  *p = str_dup (s);
 }
 
 void str_adjust (char **p)
 {
   if (!p || !*p)
     return;
-  safe_realloc (p, mutt_strlen (*p) + 1);
+  safe_realloc (p, str_len (*p) + 1);
 }
 
 /* convert all characters in the string to lowercase */
@@ -146,7 +146,7 @@ char *str_substrdup (const char *begin, const char *end)
   if (end)
     len = end - begin;
   else
-    len = mutt_strlen (begin);
+    len = str_len (begin);
 
   p = safe_malloc (len + 1);
   memcpy (p, begin, len);
@@ -176,11 +176,11 @@ const char *str_isstr (const char *haystack, const char *needle)
 }
 
 int str_eq (const char* s1, const char* s2) {
-  int l = mutt_strlen (s1);
+  int l = str_len (s1);
 
-  if (l != mutt_strlen (s2))
+  if (l != str_len (s2))
     return (0);
-  return (safe_strncmp (s1, s2, l) == 0);
+  return (str_ncmp (s1, s2, l) == 0);
 }
 
 char* str_skip_initws (char* s) {
@@ -191,6 +191,6 @@ char* str_skip_initws (char* s) {
 void str_skip_trailws (char *s) {
   char *p;
 
-  for (p = s + mutt_strlen (s) - 1; p >= s && ISSPACE (*p); p--)
+  for (p = s + str_len (s) - 1; p >= s && ISSPACE (*p); p--)
     *p = 0;
 }
index 2adf38d..ef5211d 100644 (file)
--- a/lib/str.h
+++ b/lib/str.h
@@ -7,7 +7,6 @@
  * It's licensed under the GNU General Public License,
  * please see the file GPL in the top level source directory.
  */
-
 #ifndef _LIB_STR_H
 #define _LIB_STR_H
 
  * 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 mutt_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 mutt_strlen (const char*);
+char *str_dup (const char*);
+char *str_cat (char*, size_t, const char*);
+char *str_ncat (char*, size_t, const char*, size_t);
+int str_cmp (const char*, const char*);
+int str_casecmp (const char*, const char*);
+int str_ncmp (const char*, const char*, size_t);
+int str_ncasecmp (const char*, const char*, size_t);
+int str_coll (const char*, const char*);
+size_t str_len (const char*);
 
 /*
  * tools
diff --git a/main.c b/main.c
index 1d3d349..8d4867b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -799,7 +799,7 @@ int main (int argc, char **argv)
       }
 
       if (subject)
-        msg->env->subject = safe_strdup (subject);
+        msg->env->subject = str_dup (subject);
 
       if (includeFile)
         infile = includeFile;
@@ -807,7 +807,7 @@ int main (int argc, char **argv)
 
     if (infile || bodytext) {
       if (infile) {
-        if (mutt_strcmp ("-", infile) == 0)
+        if (str_cmp ("-", infile) == 0)
           fin = stdin;
         else {
           char path[_POSIX_PATH_MAX];
@@ -826,7 +826,7 @@ int main (int argc, char **argv)
         fin = NULL;
 
       mutt_mktemp (buf);
-      tempfile = safe_strdup (buf);
+      tempfile = str_dup (buf);
 
       if (draftFile)
         msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0);
diff --git a/mbox.c b/mbox.c
index 1cd5a0c..7309d07 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -126,7 +126,7 @@ static int mmdf_parse_mailbox (CONTEXT * ctx)
     if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL)
       break;
 
-    if (mutt_strcmp (buf, MMDF_SEP) == 0) {
+    if (str_cmp (buf, MMDF_SEP) == 0) {
       loc = ftell (ctx->fp);
 
       count++;
@@ -170,7 +170,7 @@ static 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) {
+              str_cmp (MMDF_SEP, buf) != 0) {
             if (fseek (ctx->fp, loc, SEEK_SET) != 0)
               debug_print (1, ("fseek() failed\n"));
             hdr->content->length = -1;
@@ -189,7 +189,7 @@ static 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 (str_cmp (buf, MMDF_SEP) != 0);
 
         hdr->lines = lines;
         hdr->content->length = loc - hdr->content->offset;
@@ -310,7 +310,7 @@ static int mbox_parse_mailbox (CONTEXT * ctx)
            */
           if (fseek (ctx->fp, tmploc, SEEK_SET) != 0 ||
               fgets (buf, sizeof (buf), ctx->fp) == NULL ||
-              safe_strncmp ("From ", buf, 5) != 0) {
+              str_ncmp ("From ", buf, 5) != 0) {
             debug_print (1, ("bad content-length in message %d (cl=%ld)\n",
                         curhdr->index, curhdr->content->length));
             debug_print (1, ("LINE: %s\n", buf));
@@ -467,8 +467,8 @@ static int _mbox_check_mailbox (CONTEXT * ctx, int *index_hint)
       if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0)
         debug_print (1, ("fseek() failed\n"));
       if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL) {
-        if ((ctx->magic == M_MBOX && safe_strncmp ("From ", buffer, 5) == 0)
-            || (ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buffer) == 0)) {
+        if ((ctx->magic == M_MBOX && str_ncmp ("From ", buffer, 5) == 0)
+            || (ctx->magic == M_MMDF && str_cmp (MMDF_SEP, buffer) == 0)) {
           if (fseek (ctx->fp, ctx->size, SEEK_SET) != 0)
             debug_print (1, ("fseek() failed\n"));
           if (ctx->magic == M_MBOX)
@@ -749,8 +749,8 @@ static int _mbox_sync_mailbox (CONTEXT * ctx, int unused, 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 && safe_strncmp ("From ", buf, 5) != 0) ||
-      (ctx->magic == M_MMDF && mutt_strcmp (MMDF_SEP, buf) != 0)) {
+      (ctx->magic == M_MBOX && str_ncmp ("From ", buf, 5) != 0) ||
+      (ctx->magic == M_MMDF && str_cmp (MMDF_SEP, buf) != 0)) {
     debug_print (1, ("message not in expected position.\n"));
     debug_print (1, ("LINE: %s\n", buf));
     i = -1;
@@ -1091,9 +1091,9 @@ int mbox_is_magic (const char* path, struct stat* st) {
     struct utimbuf times;
 #endif
     fgets (tmp, sizeof (tmp), f);
-    if (safe_strncmp ("From ", tmp, 5) == 0)
+    if (str_ncmp ("From ", tmp, 5) == 0)
       magic = M_MBOX;
-    else if (mutt_strcmp (MMDF_SEP, tmp) == 0)
+    else if (str_cmp (MMDF_SEP, tmp) == 0)
       magic = M_MMDF;
     safe_fclose (&f);
 #ifndef BUFFY_SIZE
diff --git a/menu.c b/menu.c
index 91afd5c..08e1fb2 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 = str_len ((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, str_len (s), 1);
   tmpbuf[n - 1] = 0;
   snprintf (s, n, "%s", tmpbuf);        /* overkill */
   FREE (&tmpbuf);
diff --git a/mh.c b/mh.c
index 5c0d664..73a5638 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -157,11 +157,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 (!str_cmp (t, MhUnseen))
       f = MH_SEQ_UNSEEN;
-    else if (!mutt_strcmp (t, MhFlagged))
+    else if (!str_cmp (t, MhFlagged))
       f = MH_SEQ_FLAGGED;
-    else if (!mutt_strcmp (t, MhReplied))
+    else if (!str_cmp (t, MhReplied))
       f = MH_SEQ_REPLIED;
     else                        /* unknown sequence */
       continue;
@@ -208,7 +208,7 @@ static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
       }
     }
     else {
-      *tgt = safe_strdup (path);
+      *tgt = str_dup (path);
       break;
     }
   }
@@ -304,11 +304,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 (!safe_strncmp (buff, seq_unseen, mutt_strlen (seq_unseen)))
+      if (!str_ncmp (buff, seq_unseen, str_len (seq_unseen)))
         continue;
-      if (!safe_strncmp (buff, seq_flagged, mutt_strlen (seq_flagged)))
+      if (!str_ncmp (buff, seq_flagged, str_len (seq_flagged)))
         continue;
-      if (!safe_strncmp (buff, seq_replied, mutt_strlen (seq_replied)))
+      if (!str_ncmp (buff, seq_replied, str_len (seq_replied)))
         continue;
 
       fprintf (nfp, "%s\n", buff);
@@ -395,17 +395,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, str_len (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, str_len (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, str_len (seq_replied))) {
         fprintf (nfp, "%s %d\n", buff, n);
         replied_done = 1;
       }
@@ -488,7 +488,7 @@ static void maildir_parse_flags (HEADER * h, const char *path)
   h->read = 0;
   h->replied = 0;
 
-  if ((p = strrchr (path, ':')) != NULL && safe_strncmp (p + 1, "2,", 2) == 0) {
+  if ((p = strrchr (path, ':')) != NULL && str_ncmp (p + 1, "2,", 2) == 0) {
     p += 3;
 
     str_replace (&h->maildir_flags, p);
@@ -637,10 +637,10 @@ static int maildir_parse_entry (CONTEXT * ctx, struct maildir ***last,
 
     if (subdir) {
       snprintf (buf, sizeof (buf), "%s/%s", subdir, fname);
-      h->path = safe_strdup (buf);
+      h->path = str_dup (buf);
     }
     else
-      h->path = safe_strdup (fname);
+      h->path = str_dup (fname);
 
     entry = safe_calloc (sizeof (struct maildir), 1);
     entry->h = h;
@@ -683,7 +683,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 = (str_cmp ("cur", subdir) == 0);
   }
   else
     strfcpy (buf, ctx->path, sizeof (buf));
@@ -835,7 +835,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) : str_len (fn);
 }
 #endif
 
@@ -1001,7 +1001,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, str_len (tmp), 1, ch_compar);
     snprintf (dest, destlen, ":2,%s", tmp);
   }
 }
@@ -1055,7 +1055,7 @@ static int maildir_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr
     }
     else {
       debug_print (2, ("success.\n"));
-      msg->path = safe_strdup (path);
+      msg->path = str_dup (path);
       break;
     }
   }
@@ -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 (str_cmp (fullpath, oldpath) == 0) {
       /* message hasn't really changed */
       return 0;
     }
@@ -1605,7 +1605,7 @@ static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint, int unused)
 
   for (p = md; p; p = p->next) {
     maildir_canon_filename (buf, p->h->path, sizeof (buf));
-    p->canon_fname = safe_strdup (buf);
+    p->canon_fname = str_dup (buf);
     hash_insert (fnames, p->canon_fname, p, 0);
   }
 
@@ -1621,7 +1621,7 @@ static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint, int unused)
       /* 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))
+      if (str_cmp (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
@@ -1806,7 +1806,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 (!str_cmp (tunique, unique)) {
       snprintf (fname, sizeof (fname), "%s/%s/%s", folder, subfolder,
                 de->d_name);
       fp = fopen (fname, "r");  /* __FOPEN_CHECKED__ */
index 2665f9c..4b42e32 100644 (file)
 
 int mutt_idna_to_local (const char *in, char **out, int flags)
 {
-  *out = safe_strdup (in);
+  *out = str_dup (in);
   return 1;
 }
 
 int mutt_local_to_idna (const char *in, char **out)
 {
-  *out = safe_strdup (in);
+  *out = str_dup (in);
   return 0;
 }
 
@@ -62,7 +62,7 @@ int mutt_idna_to_local (const char *in, char **out, int flags)
   if ((flags & MI_MAY_BE_IRREVERSIBLE) == 0) {
     int irrev = 0;
     char *t2 = NULL;
-    char *tmp = safe_strdup (*out);
+    char *tmp = str_dup (*out);
 
     if (mutt_convert_string (&tmp, Charset, "utf-8", M_ICONV_HOOK_FROM) == -1)
       irrev = 1;
@@ -84,14 +84,14 @@ int mutt_idna_to_local (const char *in, char **out, int flags)
 
 notrans:
   FREE (out);
-  *out = safe_strdup (in);
+  *out = str_dup (in);
   return 1;
 }
 
 int mutt_local_to_idna (const char *in, char **out)
 {
   int rv = 0;
-  char *tmp = safe_strdup (in);
+  char *tmp = str_dup (in);
 
   *out = NULL;
 
@@ -108,7 +108,7 @@ int mutt_local_to_idna (const char *in, char **out)
   FREE (&tmp);
   if (rv < 0) {
     FREE (out);
-    *out = safe_strdup (in);
+    *out = str_dup (in);
   }
   return rv;
 }
@@ -130,7 +130,7 @@ static int mbox_to_udomain (const char *mbx, char **user, char **domain)
     return -1;
   *user = safe_calloc ((p - mbx + 1), sizeof (mbx[0]));
   strfcpy (*user, mbx, (p - mbx + 1));
-  *domain = safe_strdup (p + 1);
+  *domain = str_dup (p + 1);
   return 0;
 }
 
@@ -152,10 +152,10 @@ int mutt_addrlist_to_idna (ADDRESS * a, char **err)
     if (mutt_local_to_idna (domain, &tmp) < 0) {
       e = 1;
       if (err)
-        *err = safe_strdup (domain);
+        *err = str_dup (domain);
     }
     else {
-      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, str_len (user) + str_len (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
@@ -182,7 +182,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, str_len (user) + str_len (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp));       /* __SPRINTF_CHECKED__ */
     }
 
@@ -216,7 +216,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, str_len (tmp) + str_len (user) + 2);
   sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
   FREE (&tmp);
   FREE (&user);
index fd2a05a..f29546f 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 = str_len (SmtpHost) + 7;
   hostportstr = safe_malloc (hostportlen);
   snprintf (hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort);
   if (!smtp_set_server (session, hostportstr))
index b4d200c..017d691 100644 (file)
@@ -123,7 +123,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 < str_len (hbuf) + str_len (pbuf) + 2)
     return SASL_BUFOVER;
 
   snprintf (out, outlen, "%s;%s", hbuf, pbuf);
@@ -363,7 +363,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 = str_len (resp) + 1;
     interaction->result = safe_malloc (interaction->len);
     memcpy ((char*) interaction->result, resp, interaction->len);
 
@@ -467,7 +467,7 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result,
   }
 
   if (len)
-    *len = mutt_strlen (*result);
+    *len = str_len (*result);
 
   return SASL_OK;
 }
@@ -487,7 +487,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 = str_len (account->pass);
 
   *psecret = (sasl_secret_t *) safe_malloc (sizeof (sasl_secret_t) + len);
   (*psecret)->len = len;
index acb544a..6cccc7a 100644 (file)
@@ -103,7 +103,7 @@ int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg)
     return -1;
   }
 
-  len = mutt_strlen (buf);
+  len = str_len (buf);
   if ((rc = conn->conn_write (conn, buf, len)) < 0) {
     debug_print (1, ("error writing, closing socket\n"));
     mutt_socket_close (conn);
@@ -169,7 +169,7 @@ int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn,
 
   debug_print (dbg, ("< %s\n", buf));
 
-  /* number of bytes read, not mutt_strlen */
+  /* number of bytes read, not str_len */
   return i + 1;
 }
 
@@ -268,7 +268,7 @@ static int socket_preconnect (void)
   int rc;
   int save_errno;
 
-  if (mutt_strlen (Preconnect)) {
+  if (str_len (Preconnect)) {
     debug_print (2, ("Executing preconnect: %s\n", Preconnect));
     rc = mutt_system (Preconnect);
     debug_print (2, ("Preconnect result: %d\n", rc));
index 9092c33..870ab89 100644 (file)
@@ -415,7 +415,7 @@ static char *x509_get_part (char *line, const char *ndx)
 
   c = strstr (line, ndx);
   if (c) {
-    c += mutt_strlen (ndx);
+    c += str_len (ndx);
     c2 = strchr (c, '/');
     if (c2)
       *c2 = '\0';
@@ -441,7 +441,7 @@ static void x509_fingerprint (char *s, int l, X509 * cert)
       char ch[8];
 
       snprintf (ch, 8, "%02X%s", md[j], (j % 2 ? " " : ""));
-      safe_strcat (s, l, ch);
+      str_cat (s, l, ch);
     }
   }
 }
@@ -635,9 +635,9 @@ static int ssl_check_certificate (sslsockdata * data)
 
   helpstr[0] = '\0';
   mutt_make_help (buf, sizeof (buf), _("Exit  "), MENU_GENERIC, OP_EXIT);
-  safe_strcat (helpstr, sizeof (helpstr), buf);
+  str_cat (helpstr, sizeof (helpstr), buf);
   mutt_make_help (buf, sizeof (buf), _("Help"), MENU_GENERIC, OP_HELP);
-  safe_strcat (helpstr, sizeof (helpstr), buf);
+  str_cat (helpstr, sizeof (helpstr), buf);
   menu->help = helpstr;
 
   done = 0;
index 0c4ea8e..8f6bd23 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 (str_cmp (linestr + pmatch[1].rm_so, hostname) == 0 &&
+              str_cmp (linestr + pmatch[2].rm_so, buf) == 0) {
             regfree (&preg);
             FREE(&linestr);
             fclose (fp);
index c52c58b..f7633e1 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -86,7 +86,7 @@ void mutt_adv_mktemp (char *s, size_t l)
     mktemp (s);
     if (period != NULL) {
       *period = '.';
-      sl = mutt_strlen (s);
+      sl = str_len (s);
       strfcpy (s + sl, period, l - sl);
     }
   }
@@ -123,19 +123,19 @@ int mutt_copy_body (FILE * fp, BODY ** tgt, BODY * src)
   b->parts = NULL;
   b->next = NULL;
 
-  b->filename = safe_strdup (tmp);
+  b->filename = str_dup (tmp);
   b->use_disp = use_disp;
   b->unlink = 1;
 
   if (mutt_is_text_part (b))
     b->noconv = 1;
 
-  b->xtype = safe_strdup (b->xtype);
-  b->subtype = safe_strdup (b->subtype);
-  b->form_name = safe_strdup (b->form_name);
-  b->filename = safe_strdup (b->filename);
-  b->d_filename = safe_strdup (b->d_filename);
-  b->description = safe_strdup (b->description);
+  b->xtype = str_dup (b->xtype);
+  b->subtype = str_dup (b->subtype);
+  b->form_name = str_dup (b->form_name);
+  b->filename = str_dup (b->filename);
+  b->d_filename = str_dup (b->d_filename);
+  b->description = str_dup (b->description);
 
   /* 
    * we don't seem to need the HEADER structure currently.
@@ -149,8 +149,8 @@ int mutt_copy_body (FILE * fp, BODY ** tgt, BODY * src)
   for (par = b->parameter, ppar = &b->parameter; par;
        ppar = &(*ppar)->next, par = par->next) {
     *ppar = mutt_new_parameter ();
-    (*ppar)->attribute = safe_strdup (par->attribute);
-    (*ppar)->value = safe_strdup (par->value);
+    (*ppar)->attribute = str_dup (par->attribute);
+    (*ppar)->value = str_dup (par->value);
   }
 
   mutt_stamp_attachment (b);
@@ -215,7 +215,7 @@ void mutt_free_parameter (PARAMETER ** p)
 }
 
 LIST *mutt_add_list (LIST * head, const char *data) {
-  size_t len = mutt_strlen (data);
+  size_t len = str_len (data);
   return (mutt_add_list_n (head, data, len ? len + 1 : 0));
 }
 
@@ -282,7 +282,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, str_len (t->data))
         || *t->data == '*')
       return 1;
   }
@@ -370,7 +370,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx)
 #ifdef USE_IMAP
         /* if folder = imap[s]://host/: don't append slash */
         if (imap_is_magic (NONULL (Maildir), NULL) == M_IMAP && 
-            Maildir[mutt_strlen (Maildir) - 1] == '/')
+            Maildir[str_len (Maildir) - 1] == '/')
           strfcpy (p, NONULL (Maildir), sizeof (p));
         else
 #endif
@@ -495,7 +495,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 = str_len (pw->pw_name);
 
   for (idx = 0; dest[idx]; idx++) {
     if (dest[idx] == '&') {
@@ -537,8 +537,8 @@ void mutt_set_parameter (const char *attribute, const char *value,
   }
 
   q = mutt_new_parameter ();
-  q->attribute = safe_strdup (attribute);
-  q->value = safe_strdup (value);
+  q->attribute = str_dup (attribute);
+  q->value = str_dup (value);
   q->next = *p;
   *p = q;
 }
@@ -751,15 +751,15 @@ void mutt_pretty_mailbox (char *s)
   }
   *q = 0;
 
-  if (safe_strncmp (s, Maildir, (len = mutt_strlen (Maildir))) == 0 &&
+  if (str_ncmp (s, Maildir, (len = str_len (Maildir))) == 0 &&
       s[len] == '/') {
     *s++ = '=';
-    memmove (s, s + len, mutt_strlen (s + len) + 1);
+    memmove (s, s + len, str_len (s + len) + 1);
   }
-  else if (safe_strncmp (s, Homedir, (len = mutt_strlen (Homedir))) == 0 &&
+  else if (str_ncmp (s, Homedir, (len = str_len (Homedir))) == 0 &&
            s[len] == '/') {
     *s++ = '~';
-    memmove (s, s + len - 1, mutt_strlen (s + len - 1) + 1);
+    memmove (s, s + len - 1, str_len (s + len - 1) + 1);
   }
 }
 
@@ -799,7 +799,7 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt,
   size_t slen;
   int found = 0;
 
-  slen = mutt_strlen (src);
+  slen = str_len (src);
   destlen--;
 
   for (p = fmt, d = dest; destlen && *p; p++) {
@@ -831,8 +831,8 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt,
   *d = '\0';
 
   if (!found && destlen > 0) {
-    safe_strcat (dest, destlen, " ");
-    safe_strcat (dest, destlen, src);
+    str_cat (dest, destlen, " ");
+    str_cat (dest, destlen, src);
   }
 
 }
@@ -951,7 +951,7 @@ int mutt_skipchars (const char *s, const char *c)
     ret++;
     s++;
   }
-  return (mutt_strlen (p));
+  return (str_len (p));
 }
 
 void mutt_FormatString (char *dest,     /* output buffer */
@@ -1051,7 +1051,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 = str_len (buf);
           if (count > wid) {
             count -= wid;       /* how many chars to pad */
             memset (wptr, ch, count);
@@ -1109,7 +1109,7 @@ void mutt_FormatString (char *dest,     /* output buffer */
               *p = '_';
         }
 
-        if ((len = mutt_strlen (buf)) + wlen > destlen)
+        if ((len = str_len (buf)) + wlen > destlen)
           len = (destlen - wlen > 0) ? (destlen - wlen) : 0;
 
         memcpy (wptr, buf, len);
@@ -1180,12 +1180,12 @@ FILE *mutt_open_read (const char *path, pid_t * thepid)
   FILE *f;
   struct stat s;
 
-  int len = mutt_strlen (path);
+  int len = str_len (path);
 
   if (path[len - 1] == '|') {
     /* read from a pipe */
 
-    char *s = safe_strdup (path);
+    char *s = str_dup (path);
 
     s[len - 1] = 0;
     mutt_endwin (NULL);
@@ -1233,7 +1233,7 @@ int mutt_save_confirm (const char *s, struct stat *st)
 
   if (magic > 0 && !mx_access (s, W_OK)) {
     if (option (OPTCONFIRMAPPEND) &&
-        (!TrashPath || (mutt_strcmp (s, TrashPath) != 0))) {
+        (!TrashPath || (str_cmp (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);
       if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO)
@@ -1282,7 +1282,7 @@ void state_prefix_putc (char c, STATE * s)
   if (s->flags & M_PENDINGPREFIX) {
     int i;
 
-    i = mutt_strlen (Quotebuf);
+    i = str_len (Quotebuf);
     Quotebuf[i++] = c;
     Quotebuf[i] = '\0';
     if (i == sizeof (Quotebuf) - 1 || c == '\n') {
@@ -1336,7 +1336,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) && !str_cmp (Pager, "builtin"))
     state_puts (AttachmentMarker, s);
 }
 
@@ -1403,15 +1403,15 @@ BUFFER *mutt_buffer_from (BUFFER * b, char *seed)
     return NULL;
 
   b = mutt_buffer_init (b);
-  b->data = safe_strdup (seed);
-  b->dsize = mutt_strlen (seed);
+  b->data = str_dup (seed);
+  b->dsize = str_len (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, str_len (s));
 }
 
 void mutt_buffer_addch (BUFFER * buf, char c)
@@ -1570,8 +1570,8 @@ int mutt_cmp_header (const HEADER * h1, const HEADER * h2) {
 int mutt_cmp_addr (const ADDRESS * a, const ADDRESS * b)
 {
   while (a && b) {
-    if (mutt_strcmp (a->mailbox, b->mailbox) ||
-        mutt_strcmp (a->personal, b->personal))
+    if (str_cmp (a->mailbox, b->mailbox) ||
+        str_cmp (a->personal, b->personal))
       return (0);
 
     a = a->next;
@@ -1586,7 +1586,7 @@ int mutt_cmp_addr (const ADDRESS * a, const ADDRESS * b)
 int mutt_cmp_list (const LIST * a, const LIST * b)
 {
   while (a && b) {
-    if (mutt_strcmp (a->data, b->data))
+    if (str_cmp (a->data, b->data))
       return (0);
 
     a = a->next;
@@ -1601,8 +1601,8 @@ int mutt_cmp_list (const LIST * a, const LIST * b)
 int mutt_cmp_env (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 (str_cmp (e1->message_id, e2->message_id) ||
+        str_cmp (e1->subject, e2->subject) ||
         !mutt_cmp_list (e1->references, e2->references) ||
         !mutt_cmp_addr (e1->from, e2->from) ||
         !mutt_cmp_addr (e1->sender, e2->sender) ||
@@ -1625,8 +1625,8 @@ int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2)
 int mutt_cmp_param (const PARAMETER * p1, const PARAMETER * p2)
 {
   while (p1 && p2) {
-    if (mutt_strcmp (p1->attribute, p2->attribute) ||
-        mutt_strcmp (p1->value, p2->value))
+    if (str_cmp (p1->attribute, p2->attribute) ||
+        str_cmp (p1->value, p2->value))
       return (0);
 
     p1 = p1->next;
@@ -1642,8 +1642,8 @@ int mutt_cmp_body (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) ||
+      str_cmp (b1->subtype, b2->subtype) ||
+      str_cmp (b1->description, b2->description) ||
       !mutt_cmp_param (b1->parameter, b2->parameter) ||
       b1->length != b2->length)
     return (0);
diff --git a/mx.c b/mx.c
index 2cdbe7e..e7a4db9 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -73,7 +73,7 @@ static list2_t* MailboxFormats = NULL;
 #define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd
 #define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length)
 
-#define mutt_is_spool(s)  (mutt_strcmp (Spoolfile, s) == 0)
+#define mutt_is_spool(s)  (str_cmp (Spoolfile, s) == 0)
 
 #ifdef USE_DOTLOCK
 /* parameters: 
@@ -342,7 +342,7 @@ void mx_unlink_empty (const char *path)
 int mx_get_magic (const char *path) {
   int i = 0;
 
-  if (mutt_strlen (path) == 0)
+  if (str_len (path) == 0)
     return (-1);
   if ((i = mx_get_idx (path)) >= 0)
     return (MX_COMMAND(i,type));
@@ -520,7 +520,7 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
   if (!ctx)
     ctx = safe_malloc (sizeof (CONTEXT));
   memset (ctx, 0, sizeof (CONTEXT));
-  ctx->path = safe_strdup (path);
+  ctx->path = str_dup (path);
 
   ctx->msgnotreadyet = -1;
   ctx->collapsed = 0;
index 4dadc20..c5fa382 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) + str_len (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 (!safe_strncmp (buf, "#: ", 3) &&
-        !safe_strcasecmp (buf + 3, news->conn->account.host))
+    buf[str_len (buf) - 1] = 0;  /* strip ending '\n' */
+    if (!str_ncmp (buf, "#: ", 3) &&
+        !str_casecmp (buf + 3, news->conn->account.host))
       break;
   }
   while (fgets (buf, sizeof (buf), index)) {
@@ -217,18 +217,18 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
     if (!*cp)
       continue;
     cp[0] = 0;
-    if (!mutt_strcmp (buf, "#:"))
+    if (!str_cmp (buf, "#:"))
       break;
     sscanf (cp + 1, "%s %d %d", file, &l, &m);
-    if (!mutt_strcmp (buf, "ALL")) {
-      news->cache = safe_strdup (file);
+    if (!str_cmp (buf, "ALL")) {
+      news->cache = str_dup (file);
       news->newgroups_time = m;
     }
     else if (news->newsgroups) {
       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) + str_len (buf) + 1);
         data->group = (char *) data + sizeof (NNTP_DATA);
         strcpy (data->group, buf);
         data->nserv = news;
@@ -239,7 +239,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news)
         hash_insert (news->newsgroups, data->group, data, 0);
         nntp_add_to_list (news, data);
       }
-      data->cache = safe_strdup (file);
+      data->cache = str_dup (file);
       t = 0;
       if (!data->firstMessage || data->lastMessage < m)
         t = 1;
@@ -288,7 +288,7 @@ int nntp_parse_url (const char *server, ACCOUNT * acct,
   acct->port = NNTP_PORT;
   acct->type = M_ACCT_TYPE_NNTP;
 
-  c = safe_strdup (server);
+  c = str_dup (server);
   url_parse_ciss (&url, c);
 
   if (url.scheme == U_NNTP || url.scheme == U_NNTPS) {
@@ -312,7 +312,7 @@ void nntp_expand_path (char *line, size_t len, ACCOUNT * acct)
 {
   ciss_url_t url;
 
-  url.path = safe_strdup (line);
+  url.path = str_dup (line);
   mutt_account_tourl (acct, &url);
   url_ciss_tostring (&url, line, len, 0);
   FREE (&url.path);
@@ -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 (str_len (server) + 10, sizeof (char));
   if (url_check_scheme (server) == U_UNKNOWN) {
     strcpy (buf, "nntp://");
     p = strchr (buf, '\0');
@@ -395,7 +395,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server)
   /* New newsserver */
   serv = safe_calloc (1, sizeof (NNTP_SERVER));
   serv->conn = conn;
-  serv->newsrc = safe_strdup (file);
+  serv->newsrc = str_dup (file);
   serv->newsgroups = hash_create (1009);
   slurp_newsrc (serv);          /* load .newsrc */
   nntp_parse_cacheindex (serv); /* load .index */
@@ -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 -= str_len (line) + 1;
+  line += str_len (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);
     debug_print (2, ("Added to newsrc: %s\n", line));
-    line += mutt_strlen (line);
+    line += str_len (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 + str_len (buf) - 12; /* positioning to "cache-XXXXXX" */
   if ((fd = mkstemp (buf)) == -1)
     return NULL;
   strcpy (s, pc);               /* generated name */
@@ -742,7 +742,7 @@ int nntp_save_cache_index (NNTP_SERVER * news)
   else {
     strfcpy (buf, news->conn->account.host, sizeof (buf));
     f = mutt_mkname (buf);
-    news->cache = safe_strdup (buf);
+    news->cache = str_dup (buf);
     nntp_cache_expand (file, buf);
   }
   if (!f)
@@ -798,7 +798,7 @@ int nntp_save_cache_group (CONTEXT * ctx)
               ((NNTP_DATA *) ctx->data)->nserv->conn->account.host,
               ((NNTP_DATA *) ctx->data)->group);
     f = mutt_mkname (buf);
-    ((NNTP_DATA *) ctx->data)->cache = safe_strdup (buf);
+    ((NNTP_DATA *) ctx->data)->cache = str_dup (buf);
     nntp_cache_expand (file, buf);
   }
   if (!f)
@@ -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) + str_len (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)) {
+          !str_cmp (data->group, ((NNTP_DATA *) Context->data)->group)) {
         unsigned int i, unread = 0;
 
         for (i = 0; i < Context->msgcount; i++)
index a0fd012..ac32993 100644 (file)
@@ -74,7 +74,7 @@ static int nntp_auth (NNTP_SERVER * serv)
     return -1;
   }
 
-  if (safe_strncmp ("281", buf, 3)) {
+  if (str_ncmp ("281", buf, 3)) {
     conn->account.flags = flags;
     mutt_error _("Login failed.");
 
@@ -109,9 +109,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 (!safe_strncmp ("200", buf, 3))
+  if (!str_ncmp ("200", buf, 3))
     mutt_message (_("Connected to %s. Posting ok."), conn->account.host);
-  else if (!safe_strncmp ("201", buf, 3))
+  else if (!str_ncmp ("201", buf, 3))
     mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
   else {
     mutt_socket_close (conn);
@@ -133,7 +133,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) && safe_strncmp ("480", buf, 3)) {
+  if (!(conn->account.flags & M_ACCT_USER) && str_ncmp ("480", buf, 3)) {
     serv->status = NNTP_OK;
     return 0;
   }
@@ -165,28 +165,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 (safe_strncmp ("500", buf, 3))
+  if (str_ncmp ("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 (safe_strncmp ("500", buf, 3))
+  if (str_ncmp ("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 (safe_strncmp ("500", buf, 3))
+  if (str_ncmp ("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 (safe_strncmp ("500", buf, 3))
+  if (str_ncmp ("500", buf, 3))
     serv->hasXGTITLE = 1;
 
-  if (!safe_strncmp ("282", buf, 3)) {
+  if (!str_ncmp ("282", buf, 3)) {
     do {
       if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
         return nntp_connect_error (serv);
@@ -260,7 +260,7 @@ static int mutt_nntp_query (NNTP_DATA * data, char *line, size_t linelen)
       if (*line)
         done = FALSE;
     }
-    else if ((!safe_strncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0)
+    else if ((!str_ncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0)
       return -1;
   } while (!done);
 
@@ -321,7 +321,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 += str_len (p);
       }
       else {
         line++;
@@ -388,7 +388,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 && str_cmp (group, b) == 0)
         h->article_num = atoi (colon);
     }
   }
@@ -460,9 +460,9 @@ static int parse_description (char *line, void *n)
     d++;
   debug_print (2, ("group: %s, desc: %s\n", line, d));
   if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
-      mutt_strcmp (d, data->desc)) {
+      str_cmp (d, data->desc)) {
     FREE (&data->desc);
-    data->desc = safe_strdup (d);
+    data->desc = str_dup (d);
   }
   return 0;
 #undef news
@@ -503,10 +503,10 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
   int x, done = 0;
 
   hdr->env = mutt_new_envelope ();
-  hdr->env->newsgroups = safe_strdup (nntp_data->group);
+  hdr->env->newsgroups = str_dup (nntp_data->group);
   hdr->content = mutt_new_body ();
   hdr->content->type = TYPETEXT;
-  hdr->content->subtype = safe_strdup ("plain");
+  hdr->content->subtype = str_dup ("plain");
   hdr->content->encoding = ENC7BIT;
   hdr->content->disposition = DISPINLINE;
   hdr->content->length = -1;
@@ -527,7 +527,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
       nntp_get_status (ctx, hdr, NULL, hdr->article_num);
       break;
     case 1:
-      hdr->env->subject = safe_strdup (b);
+      hdr->env->subject = str_dup (b);
       /* Now we need to do the things which would normally be done in 
        * mutt_read_rfc822_header() */
       if (hdr->env->subject) {
@@ -552,7 +552,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
       break;
     case 4:
       FREE (&hdr->env->message_id);
-      hdr->env->message_id = safe_strdup (b);
+      hdr->env->message_id = str_dup (b);
       break;
     case 5:
       mutt_free_list (&hdr->env->references);
@@ -568,7 +568,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr)
       if (!hdr->read)
         FREE (&hdr->env->xref);
       b = b + 6;                /* skips the "Xref: " */
-      hdr->env->xref = safe_strdup (b);
+      hdr->env->xref = str_dup (b);
       nntp_parse_xref (ctx, nntp_data->group, b, hdr);
     }
     if (!*p)
@@ -814,7 +814,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) + str_len (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);
@@ -839,11 +839,11 @@ int nntp_open_mailbox (CONTEXT * ctx)
     return -1;
   }
 
-  if (safe_strncmp ("211", buf, 3)) {
+  if (str_ncmp ("211", buf, 3)) {
     LIST *l = serv->list;
 
     /* GROUP command failed */
-    if (!safe_strncmp ("411", buf, 3)) {
+    if (!str_ncmp ("411", buf, 3)) {
       mutt_error (_("Newsgroup %s not found on server %s"),
                   nntp_data->group, serv->conn->account.host);
 
@@ -907,7 +907,7 @@ int nntp_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
 
   cache->index = ctx->hdrs[msgno]->index;
   mutt_mktemp (path);
-  cache->path = safe_strdup (path);
+  cache->path = str_dup (path);
   if (!(msg->fp = safe_fopen (path, "w+"))) {
     FREE (&cache->path);
     return -1;
@@ -999,7 +999,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 = str_len (buf);
     if (buf[len - 1] == '\n') {
       buf[len - 1] = '\r';
       buf[len] = '\n';
@@ -1013,7 +1013,7 @@ int nntp_post (const char *msg)
   }
   fclose (f);
 
-  if (buf[mutt_strlen (buf) - 1] != '\n')
+  if (buf[str_len (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) {
@@ -1156,7 +1156,7 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
 #endif
     return -1;
   }
-  if (safe_strncmp ("211", buf, 3)) {
+  if (str_ncmp ("211", buf, 3)) {
     buf[0] = 0;
     if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
 #ifdef DEBUG
@@ -1165,7 +1165,7 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
       return -1;
     }
   }
-  if (!safe_strncmp ("211", buf, 3)) {
+  if (!str_ncmp ("211", buf, 3)) {
     int first;
     int last;
 
@@ -1224,7 +1224,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) + str_len (group) + 1);
     nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
     strcpy (nntp_data->group, group);
     nntp_data->nserv = s;
@@ -1243,7 +1243,7 @@ static int add_group (char *buf, void *serv)
   if (nntp_data->desc)
     FREE (&nntp_data->desc);
   if (*desc)
-    nntp_data->desc = safe_strdup (desc);
+    nntp_data->desc = str_dup (desc);
   if (nntp_data->rc || nntp_data->lastCached)
     mutt_newsgroup_stat (nntp_data);
   else if (nntp_data->lastMessage &&
diff --git a/pager.c b/pager.c
index da23902..d3a4b4e 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -381,7 +381,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 (safe_strncmp (qptr, q_list->prefix, length) == 0) {
+      if (str_ncmp (qptr, q_list->prefix, length) == 0) {
         if (length == q_list->length)
           return q_list;        /* same prefix: return the current class */
 
@@ -470,7 +470,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
-          && safe_strncmp (qptr, q_list->prefix, q_list->length) == 0) {
+          && str_ncmp (qptr, q_list->prefix, q_list->length) == 0) {
         /* ok, it's a subclass somewhere on this branch */
 
         ptr = q_list;
@@ -482,7 +482,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
 
         while (q_list) {
           if (length <= q_list->length) {
-            if (safe_strncmp (tail_qptr, (q_list->prefix) + offset, tail_lng)
+            if (str_ncmp (tail_qptr, (q_list->prefix) + offset, tail_lng)
                 == 0) {
               /* same prefix: return the current class */
               if (length == q_list->length)
@@ -566,7 +566,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
-                && safe_strncmp (tail_qptr, (q_list->prefix) + offset,
+                && str_ncmp (tail_qptr, (q_list->prefix) + offset,
                                  q_list->length - offset) == 0) {
               /* still a subclass: go down one level */
               ptr = q_list;
@@ -672,17 +672,17 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last,
       }
     }
   }
-  else if (safe_strncmp ("\033[0m", raw, 4) == 0)       /* a little hack... */
+  else if (str_ncmp ("\033[0m", raw, 4) == 0)       /* a little hack... */
     lineInfo[n].type = MT_COLOR_NORMAL;
 #if 0
-  else if (safe_strncmp ("[-- ", buf, 4) == 0)
+  else if (str_ncmp ("[-- ", 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 (str_cmp ("-- \n", buf) == 0
+           || str_cmp ("-- \r\n", buf) == 0) {
     i = n + 1;
 
     lineInfo[n].type = MT_COLOR_SIGNATURE;
@@ -2327,7 +2327,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 || safe_strcasecmp (followup_to, "poster") ||
+      if (!followup_to || str_casecmp (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 ee8d70f..7cb195f 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -47,7 +47,7 @@ static char *read_rfc822_line (FILE * f, char *line, size_t * linelen)
       return (line);
     }
 
-    buf += mutt_strlen (buf) - 1;
+    buf += str_len (buf) - 1;
     if (*buf == '\n') {
       /* we did get a full line. remove trailing space */
       while (ISSPACE (*buf))
@@ -96,17 +96,17 @@ LIST *mutt_parse_references (char *s, int in_reply_to)
     new = NULL;
 
     if (*s == '<') {
-      n = mutt_strlen (s);
+      n = str_len (s);
       if (s[n - 1] != '>') {
         o = s;
         s = NULL;
         continue;
       }
 
-      new = safe_strdup (s);
+      new = str_dup (s);
     }
     else if (o) {
-      m = mutt_strlen (s);
+      m = str_len (s);
       if (s[m - 1] == '>') {
         new = safe_malloc (sizeof (char) * (n + m + 1));
         strcpy (new, o);        /* __STRCPY_CHECKED__ */
@@ -231,7 +231,7 @@ static PARAMETER *parse_parameters (const char *s)
         buffer[i] = 0;
       }
 
-      new->value = safe_strdup (buffer);
+      new->value = str_dup (buffer);
 
       debug_print (2, ("`%s' = `%s'\n", new->attribute ? new->attribute : "", 
                   new->value ? new->value : ""));
@@ -314,7 +314,7 @@ void mutt_parse_content_type (char *s, BODY * ct)
      * let that take precedence, and don't set it here */
     if ((pc = mutt_get_parameter ("name", ct->parameter)) != 0
         && !ct->filename)
-      ct->filename = safe_strdup (pc);
+      ct->filename = str_dup (pc);
 
 #ifdef SUN_ATTACHMENT
     /* this is deep and utter perversion */
@@ -329,7 +329,7 @@ void mutt_parse_content_type (char *s, BODY * ct)
     *subtype++ = '\0';
     for (pc = subtype; *pc && !ISSPACE (*pc) && *pc != ';'; pc++);
     *pc = '\0';
-    ct->subtype = safe_strdup (subtype);
+    ct->subtype = str_dup (subtype);
   }
 
   /* Finally, get the major type */
@@ -337,11 +337,11 @@ void mutt_parse_content_type (char *s, BODY * ct)
 
 #ifdef SUN_ATTACHMENT
   if (ascii_strcasecmp ("x-sun-attachment", s) == 0)
-    ct->subtype = safe_strdup ("x-sun-attachment");
+    ct->subtype = str_dup ("x-sun-attachment");
 #endif
 
   if (ct->type == TYPEOTHER) {
-    ct->xtype = safe_strdup (s);
+    ct->xtype = str_dup (s);
   }
 
   if (ct->subtype == NULL) {
@@ -349,20 +349,20 @@ void mutt_parse_content_type (char *s, BODY * ct)
      * field, so we can attempt to convert the type to BODY here.
      */
     if (ct->type == TYPETEXT)
-      ct->subtype = safe_strdup ("plain");
+      ct->subtype = str_dup ("plain");
     else if (ct->type == TYPEAUDIO)
-      ct->subtype = safe_strdup ("basic");
+      ct->subtype = str_dup ("basic");
     else if (ct->type == TYPEMESSAGE)
-      ct->subtype = safe_strdup ("rfc822");
+      ct->subtype = str_dup ("rfc822");
     else if (ct->type == TYPEOTHER) {
       char buffer[SHORT_STRING];
 
       ct->type = TYPEAPPLICATION;
       snprintf (buffer, sizeof (buffer), "x-%s", s);
-      ct->subtype = safe_strdup (buffer);
+      ct->subtype = str_dup (buffer);
     }
     else
-      ct->subtype = safe_strdup ("x-unknown");
+      ct->subtype = str_dup ("x-unknown");
   }
 
   /* Default character set for text types. */
@@ -396,7 +396,7 @@ static void parse_content_disposition (char *s, BODY * ct)
                              (parms = parse_parameters (s)))) != 0)
       str_replace (&ct->filename, s);
     if ((s = mutt_get_parameter ("name", parms)) != 0)
-      ct->form_name = safe_strdup (s);
+      ct->form_name = str_dup (s);
     mutt_free_parameter (&parms);
   }
 }
@@ -466,9 +466,9 @@ BODY *mutt_read_mime_header (FILE * fp, int digest)
   }
   p->offset = ftell (fp);       /* Mark the start of the real data */
   if (p->type == TYPETEXT && !p->subtype)
-    p->subtype = safe_strdup ("plain");
+    p->subtype = str_dup ("plain");
   else if (p->type == TYPEMESSAGE && !p->subtype)
-    p->subtype = safe_strdup ("rfc822");
+    p->subtype = str_dup ("rfc822");
 
   FREE (&line);
 
@@ -582,14 +582,14 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off,
     return (NULL);
   }
 
-  blen = mutt_strlen (boundary);
+  blen = str_len (boundary);
   while (ftell (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) {
-    len = mutt_strlen (buffer);
+    len = str_len (buffer);
 
     crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0;
 
     if (buffer[0] == '-' && buffer[1] == '-' &&
-        safe_strncmp (buffer + 2, boundary, blen) == 0) {
+        str_ncmp (buffer + 2, boundary, blen) == 0) {
       if (last) {
         last->length = ftell (fp) - last->offset - len - 1 - crlf;
         if (last->parts && last->parts->length == 0)
@@ -605,7 +605,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 (str_cmp (buffer + blen + 2, "--") == 0) {
         final = 1;
         break;                  /* done parsing */
       }
@@ -1030,15 +1030,15 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
        * bothered me for _years_ */
       if (!e->from) {
         e->from = rfc822_new_address ();
-        e->from->personal = safe_strdup (line + 6);
+        e->from->personal = str_dup (line + 6);
       }
       matched = 1;
     }
 #ifdef USE_NNTP
-    else if (!safe_strcasecmp (line + 1, "ollowup-to")) {
+    else if (!str_casecmp (line + 1, "ollowup-to")) {
       if (!e->followup_to) {
         str_skip_trailws (p);
-        e->followup_to = safe_strdup (str_skip_initws (p));
+        e->followup_to = str_dup (str_skip_initws (p));
       }
       matched = 1;
     }
@@ -1118,10 +1118,10 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
 
 #ifdef USE_NNTP
   case 'n':
-    if (!safe_strcasecmp (line + 1, "ewsgroups")) {
+    if (!str_casecmp (line + 1, "ewsgroups")) {
       FREE (&e->newsgroups);
       str_skip_trailws (p);
-      e->newsgroups = safe_strdup (str_skip_initws (p));
+      e->newsgroups = str_dup (str_skip_initws (p));
       matched = 1;
     }
     break;
@@ -1129,9 +1129,9 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
 
   case 'o':
     /* field `Organization:' saves only for pager! */
-    if (!safe_strcasecmp (line + 1, "rganization")) {
-      if (!e->organization && safe_strcasecmp (p, "unknown"))
-        e->organization = safe_strdup (p);
+    if (!str_casecmp (line + 1, "rganization")) {
+      if (!e->organization && str_casecmp (p, "unknown"))
+        e->organization = str_dup (p);
     }
     break;
 
@@ -1162,7 +1162,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
   case 's':
     if (!ascii_strcasecmp (line + 1, "ubject")) {
       if (!e->subject)
-        e->subject = safe_strdup (p);
+        e->subject = str_dup (p);
       matched = 1;
     }
     else if (!ascii_strcasecmp (line + 1, "ender")) {
@@ -1190,7 +1190,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
     }
     else if ((!ascii_strcasecmp ("upersedes", line + 1) ||
               !ascii_strcasecmp ("upercedes", line + 1)) && hdr)
-      e->supersedes = safe_strdup (p);
+      e->supersedes = str_dup (p);
     break;
 
   case 't':
@@ -1223,18 +1223,18 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
       matched = 1;
     }
     else if (ascii_strcasecmp (line + 1, "-label") == 0) {
-      e->x_label = safe_strdup (p);
+      e->x_label = str_dup (p);
       matched = 1;
     }
 #ifdef USE_NNTP
-    else if (!safe_strcasecmp (line + 1, "-comment-to")) {
+    else if (!str_casecmp (line + 1, "-comment-to")) {
       if (!e->x_comment_to)
-        e->x_comment_to = safe_strdup (p);
+        e->x_comment_to = str_dup (p);
       matched = 1;
     }
-    else if (!safe_strcasecmp (line + 1, "ref")) {
+    else if (!str_casecmp (line + 1, "ref")) {
       if (!e->xref)
-        e->xref = safe_strdup (p);
+        e->xref = str_dup (p);
       matched = 1;
     }
 #endif
@@ -1246,7 +1246,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[str_len (line)] = ':';
 
     if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore)
         && !mutt_matches_ignore (line, UnIgnore))
@@ -1258,7 +1258,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p,
     }
     else
       last = e->userhdrs = mutt_new_list ();
-    last->data = safe_strdup (line);
+    last->data = str_dup (line);
     if (do_2047)
       rfc2047_decode (&last->data);
   }
@@ -1306,7 +1306,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE * f, HEADER * hdr, short user_hdrs,
 
       /* set the defaults from RFC1521 */
       hdr->content->type = TYPETEXT;
-      hdr->content->subtype = safe_strdup ("plain");
+      hdr->content->subtype = str_dup ("plain");
       hdr->content->encoding = ENC7BIT;
       hdr->content->length = -1;
 
@@ -1324,7 +1324,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 (safe_strncmp (">From ", line, 6) == 0)
+      if (str_ncmp (">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 5b9c13a..8b92597 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 -= str_len (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 = str_len (s);
 
   while (*ps.dptr) {
     SKIPWS (ps.dptr);
@@ -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 || !str_cmp ("^", s) || !str_cmp (".", s))     /* ~A is more efficient */
       strfcpy (s, "~A", len);
     else if (ascii_strcasecmp ("del", s) == 0)
       strfcpy (s, "~D", len);
@@ -1143,7 +1143,7 @@ int mutt_pattern_func (int op, char *prompt)
 
   mutt_message _("Compiling search pattern...");
 
-  simple = safe_strdup (buf);
+  simple = str_dup (buf);
   mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch));
 
   err.data = error;
@@ -1223,7 +1223,7 @@ int mutt_pattern_func (int op, char *prompt)
       }
 #endif
     }
-    else if (safe_strncmp (buf, "~A", 2) != 0) {
+    else if (str_ncmp (buf, "~A", 2) != 0) {
       Context->pattern = simple;
       simple = NULL;            /* don't clobber it */
       Context->limit_pattern = mutt_pattern_comp (buf, M_FULL_MSG, &err);
@@ -1261,7 +1261,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 || str_cmp (temp, LastSearchExpn)) {
       set_option (OPTSEARCHINVALID);
       strfcpy (LastSearch, buf, sizeof (LastSearch));
       mutt_message _("Compiling search pattern...");
diff --git a/pgp.c b/pgp.c
index f584031..5e886db 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -195,7 +195,7 @@ static void pgp_copy_clearsigned (FILE * fpin, STATE * s, char *charset)
       continue;
     }
 
-    if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
+    if (str_cmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
       break;
 
     if (armor_header) {
@@ -251,21 +251,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 str_len(buf) */
     last_pos = offset;
 
-    if (safe_strncmp ("-----BEGIN PGP ", buf, 15) == 0) {
+    if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
       clearsign = 0;
       start_pos = last_pos;
 
-      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+      if (str_cmp ("MESSAGE-----\n", buf + 15) == 0)
         needpass = 1;
-      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) {
+      else if (str_cmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) {
         clearsign = 1;
         needpass = 0;
       }
       else if (!option (OPTDONTHANDLEPGPKEYS) &&
-               mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) {
+               str_cmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) {
         needpass = 0;
         pgp_keyblock = 1;
       }
@@ -289,16 +289,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 str_len(buf) */
         last_pos = offset;
 
         fputs (buf, tmpfp);
 
         if ((needpass
-             && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0)
+             && str_cmp ("-----END PGP MESSAGE-----\n", buf) == 0)
             || (!needpass
-                && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
-                    || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
+                && (str_cmp ("-----END PGP SIGNATURE-----\n", buf) == 0
+                    || str_cmp ("-----END PGP PUBLIC KEY BLOCK-----\n",
                                     buf) == 0)))
           break;
       }
@@ -472,12 +472,12 @@ static int pgp_check_traditional_one_body (FILE * fp, BODY * b,
   }
 
   while (fgets (buf, sizeof (buf), tfp)) {
-    if (safe_strncmp ("-----BEGIN PGP ", buf, 15) == 0) {
-      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+    if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) {
+      if (str_cmp ("MESSAGE-----\n", buf + 15) == 0)
         enc = 1;
-      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+      else if (str_cmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
         sgn = 1;
-      else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
+      else if (str_cmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
         key = 1;
     }
   }
@@ -747,7 +747,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 = str_len (buf);
     if (len > 1 && buf[len - 2] == '\r')
       strcpy (buf + len - 2, "\n");     /* __STRCPY_CHECKED__ */
     fputs (buf, fpout);
@@ -950,9 +950,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 (str_cmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
       fputs ("-----BEGIN PGP SIGNATURE-----\n", fp);
-    else if (mutt_strcmp ("-----END PGP MESSAGE-----\n", buffer) == 0)
+    else if (str_cmp ("-----END PGP MESSAGE-----\n", buffer) == 0)
       fputs ("-----END PGP SIGNATURE-----\n", fp);
     else
       fputs (buffer, fp);
@@ -991,7 +991,7 @@ BODY *pgp_sign_message (BODY * a)
 
   t = mutt_new_body ();
   t->type = TYPEMULTIPART;
-  t->subtype = safe_strdup ("signed");
+  t->subtype = str_dup ("signed");
   t->encoding = ENC7BIT;
   t->use_disp = 0;
   t->disposition = DISPINLINE;
@@ -1006,8 +1006,8 @@ BODY *pgp_sign_message (BODY * a)
   t->parts->next = mutt_new_body ();
   t = t->parts->next;
   t->type = TYPEAPPLICATION;
-  t->subtype = safe_strdup ("pgp-signature");
-  t->filename = safe_strdup (sigfile);
+  t->subtype = str_dup ("pgp-signature");
+  t->filename = str_dup (sigfile);
   t->use_disp = 0;
   t->disposition = DISPINLINE;
   t->encoding = ENC7BIT;
@@ -1021,7 +1021,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 (str_len (s) % 8)
     return 0;
   while (*s)
     if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL)
@@ -1129,11 +1129,11 @@ char *pgp_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
     keyID = pgp_keyid (key);
 
   bypass_selection:
-    keylist_size += mutt_strlen (keyID) + 4;
+    keylist_size += str_len (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 = str_len (keylist);
 
     pgp_free_key (&key);
     rfc822_free_address (&addr);
@@ -1237,7 +1237,7 @@ BODY *pgp_encrypt_message (BODY * a, char *keylist, int sign)
 
   t = mutt_new_body ();
   t->type = TYPEMULTIPART;
-  t->subtype = safe_strdup ("encrypted");
+  t->subtype = str_dup ("encrypted");
   t->encoding = ENC7BIT;
   t->use_disp = 0;
   t->disposition = DISPINLINE;
@@ -1247,18 +1247,18 @@ BODY *pgp_encrypt_message (BODY * a, char *keylist, int sign)
 
   t->parts = mutt_new_body ();
   t->parts->type = TYPEAPPLICATION;
-  t->parts->subtype = safe_strdup ("pgp-encrypted");
+  t->parts->subtype = str_dup ("pgp-encrypted");
   t->parts->encoding = ENC7BIT;
 
   t->parts->next = mutt_new_body ();
   t->parts->next->type = TYPEAPPLICATION;
-  t->parts->next->subtype = safe_strdup ("octet-stream");
+  t->parts->next->subtype = str_dup ("octet-stream");
   t->parts->next->encoding = ENC7BIT;
-  t->parts->next->filename = safe_strdup (tempfile);
+  t->parts->next->filename = str_dup (tempfile);
   t->parts->next->use_disp = 1;
   t->parts->next->disposition = DISPINLINE;
   t->parts->next->unlink = 1;   /* delete after sending the message */
-  t->parts->next->d_filename = safe_strdup ("msg.asc"); /* non pgp/mime can save */
+  t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime can save */
 
   return (t);
 }
@@ -1408,21 +1408,21 @@ BODY *pgp_traditional_encryptsign (BODY * a, int flags, char *keylist)
   b->encoding = ENC7BIT;
 
   b->type = TYPETEXT;
-  b->subtype = safe_strdup ("plain");
+  b->subtype = str_dup ("plain");
 
   mutt_set_parameter ("x-action",
                       flags & ENCRYPT ? "pgp-encrypted" : "pgp-signed",
                       &b->parameter);
   mutt_set_parameter ("charset", send_charset, &b->parameter);
 
-  b->filename = safe_strdup (pgpoutfile);
+  b->filename = str_dup (pgpoutfile);
 
 #if 0
   /* The following is intended to give a clue to some completely brain-dead 
    * "mail environments" which are typically used by large corporations.
    */
 
-  b->d_filename = safe_strdup ("msg.pgp");
+  b->d_filename = str_dup ("msg.pgp");
   b->use_disp = 1;
 
 #endif
index 8bf2534..4c476c9 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -278,10 +278,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 = safe_strcasecmp ((*s)->addr, (*t)->addr)))
+  if ((r = str_casecmp ((*s)->addr, (*t)->addr)))
     return r > 0;
   else
-    return (safe_strcasecmp (_pgp_keyid ((*s)->parent),
+    return (str_casecmp (_pgp_keyid ((*s)->parent),
                              _pgp_keyid ((*t)->parent)) > 0);
 }
 
@@ -300,11 +300,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 = safe_strcasecmp (_pgp_keyid ((*s)->parent),
+  if ((r = str_casecmp (_pgp_keyid ((*s)->parent),
                             _pgp_keyid ((*t)->parent))))
     return r > 0;
   else
-    return (safe_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
+    return (str_casecmp ((*s)->addr, (*t)->addr)) > 0;
 }
 
 static int pgp_compare_keyid (const void *a, const void *b)
@@ -321,7 +321,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 (safe_strcasecmp ((*s)->addr, (*t)->addr)) > 0;
+  return (str_casecmp ((*s)->addr, (*t)->addr)) > 0;
 }
 
 static int pgp_compare_date (const void *a, const void *b)
@@ -346,9 +346,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 = safe_strcasecmp ((*s)->addr, (*t)->addr)))
+  if ((r = str_casecmp ((*s)->addr, (*t)->addr)))
     return r > 0;
-  return (safe_strcasecmp (_pgp_keyid ((*s)->parent),
+  return (str_casecmp (_pgp_keyid ((*s)->parent),
                            _pgp_keyid ((*t)->parent))) > 0;
 }
 
@@ -407,11 +407,11 @@ static int pgp_id_matches_addr (ADDRESS * addr, ADDRESS * u_addr,
     rv |= PGP_KV_STRONGID;
 
   if (addr->mailbox && u_addr->mailbox
-      && safe_strcasecmp (addr->mailbox, u_addr->mailbox) == 0)
+      && str_casecmp (addr->mailbox, u_addr->mailbox) == 0)
     rv |= PGP_KV_ADDR;
 
   if (addr->personal && u_addr->personal
-      && safe_strcasecmp (addr->personal, u_addr->personal) == 0)
+      && str_casecmp (addr->personal, u_addr->personal) == 0)
     rv |= PGP_KV_STRING;
 
   return rv;
@@ -642,7 +642,7 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor,
   if (whatfor) {
 
     for (l = id_defaults; l; l = l->next)
-      if (!safe_strcasecmp (whatfor, l->what)) {
+      if (!str_casecmp (whatfor, l->what)) {
         strfcpy (resp, NONULL (l->dflt), sizeof (resp));
         break;
       }
@@ -661,8 +661,8 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor,
         l = safe_malloc (sizeof (struct pgp_cache));
         l->next = id_defaults;
         id_defaults = l;
-        l->what = safe_strdup (whatfor);
-        l->dflt = safe_strdup (resp);
+        l->what = str_dup (whatfor);
+        l->dflt = str_dup (resp);
       }
     }
 
@@ -738,13 +738,13 @@ BODY *pgp_make_key_attachment (char *tempf)
   fclose (devnull);
 
   att = mutt_new_body ();
-  att->filename = safe_strdup (tempf);
+  att->filename = str_dup (tempf);
   att->unlink = 1;
   att->use_disp = 0;
   att->type = TYPEAPPLICATION;
-  att->subtype = safe_strdup ("pgp-keys");
+  att->subtype = str_dup ("pgp-keys");
   snprintf (buff, sizeof (buff), _("PGP Key %s."), tmp);
-  att->description = safe_strdup (buff);
+  att->description = str_dup (buff);
   mutt_update_encoding (att);
 
   stat (tempf, &sb);
@@ -758,12 +758,12 @@ static LIST *pgp_add_string_to_hints (LIST * hints, const char *str)
   char *scratch;
   char *t;
 
-  if ((scratch = safe_strdup (str)) == NULL)
+  if ((scratch = str_dup (str)) == NULL)
     return hints;
 
   for (t = strtok (scratch, " ,.:\"()<>\n"); t;
        t = strtok (NULL, " ,.:\"()<>\n")) {
-    if (mutt_strlen (t) > 3)
+    if (str_len (t) > 3)
       hints = mutt_add_list (hints, t);
   }
 
@@ -928,11 +928,11 @@ pgp_key_t pgp_getkeybystr (char *p, short abilities, pgp_ring_t keyring)
 
     for (a = k->address; a; a = a->next) {
       debug_print (5, ("matching \"%s\" against key %s, \"%s\":\n", p, pgp_keyid (k), a->addr));
-      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))
+      if (!*p || str_casecmp (p, pgp_keyid (k)) == 0
+          || (!str_ncasecmp (p, "0x", 2)
+              && !str_casecmp (p + 2, pgp_keyid (k)))
+          || (option (OPTPGPLONGIDS) && !str_ncasecmp (p, "0x", 2)
+              && !str_casecmp (p + 2, k->keyid + 8))
           || str_isstr (a->addr, p)) {
         debug_print (5, ("match.\n"));
         match = 1;
index d39f076..c3e5af1 100644 (file)
--- a/pgplib.c
+++ b/pgplib.c
@@ -147,7 +147,7 @@ pgp_uid_t *pgp_copy_uids (pgp_uid_t * up, pgp_key_t parent)
     *lp = safe_calloc (1, sizeof (pgp_uid_t));
     (*lp)->trust = up->trust;
     (*lp)->flags = up->flags;
-    (*lp)->addr = safe_strdup (up->addr);
+    (*lp)->addr = str_dup (up->addr);
     (*lp)->parent = parent;
     lp = &(*lp)->next;
   }
index 6d2df9e..344eba5 100644 (file)
@@ -105,7 +105,7 @@ static void pgp_dearmor (FILE * in, FILE * out)
     return;
   }
 
-  if ((end = ftell (in) - mutt_strlen (line)) < start) {
+  if ((end = ftell (in) - str_len (line)) < start) {
     debug_print (1, ("end < start???\n"));
     return;
   }
index 6207502..4ded33e 100644 (file)
@@ -246,7 +246,7 @@ static pgp_key_t pgp_parse_pgp2_key (unsigned char *buff, size_t l)
               "%08lX", id);
   }
 
-  p->keyid = safe_strdup ((char *) scratch);
+  p->keyid = str_dup ((char *) scratch);
 
   return p;
 
@@ -348,7 +348,7 @@ static pgp_key_t pgp_parse_pgp3_key (unsigned char *buff, size_t l)
               id);
   }
 
-  p->keyid = safe_strdup ((char *) scratch);
+  p->keyid = str_dup ((char *) scratch);
 
   return p;
 }
@@ -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 + str_len (ringfile) + 1;
     error_buf = safe_malloc (error_buf_len);
     snprintf (error_buf, error_buf_len, "fopen: %s", ringfile);
     perror (error_buf);
index ab5b739..87912b7 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 (!str_cmp (line, ctx->hdrs[i]->data))
       break;
 
   if (i == ctx->msgcount) {
@@ -135,7 +135,7 @@ static int fetch_uidl (char *line, void *data)
 
     ctx->msgcount++;
     ctx->hdrs[i] = mutt_new_header ();
-    ctx->hdrs[i]->data = safe_strdup (line);
+    ctx->hdrs[i]->data = str_dup (line);
   }
   else if (ctx->hdrs[i]->index != index - 1)
     pop_data->clear_cache = 1;
@@ -241,7 +241,7 @@ int pop_open_mailbox (CONTEXT * ctx)
     return -1;
 
   FREE (&ctx->path);
-  ctx->path = safe_strdup (buf);
+  ctx->path = str_dup (buf);
 
   pop_data = safe_calloc (1, sizeof (POP_DATA));
   pop_data->conn = conn;
@@ -396,7 +396,7 @@ int pop_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
    * portion of the headers, those required for the main display.
    */
   cache->index = h->index;
-  cache->path = safe_strdup (path);
+  cache->path = str_dup (path);
   rewind (msg->fp);
   uidl = h->data;
   mutt_free_envelope (&h->env);
index 840f9e8..194f33b 100644 (file)
@@ -103,11 +103,11 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
       break;
 
 #ifdef USE_SASL2
-    if (!safe_strncmp (inbuf, "+ ", 2)
+    if (!str_ncmp (inbuf, "+ ", 2)
         && sasl_decode64 (inbuf, strlen (inbuf), buf, LONG_STRING - 1,
                           &len) != SASL_OK)
 #else
-    if (!safe_strncmp (inbuf, "+ ", 2)
+    if (!str_ncmp (inbuf, "+ ", 2)
         && sasl_decode64 (inbuf, strlen (inbuf), buf, &len) != SASL_OK)
 #endif
     {
@@ -146,7 +146,7 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method)
   if (rc != SASL_OK)
     goto bail;
 
-  if (!safe_strncmp (inbuf, "+OK", 3)) {
+  if (!str_ncmp (inbuf, "+OK", 3)) {
     mutt_sasl_setup_conn (pop_data->conn, saslconn);
     return POP_A_SUCCESS;
   }
@@ -155,7 +155,7 @@ bail:
   sasl_dispose (&saslconn);
 
   /* terminate SASL sessoin if the last responce is not +OK nor -ERR */
-  if (!safe_strncmp (inbuf, "+ ", 2)) {
+  if (!str_ncmp (inbuf, "+ ", 2)) {
     snprintf (buf, sizeof (buf), "*\r\n");
     if (pop_query (pop_data, buf, sizeof (buf)) == PQ_NOT_CONNECTED)
       return POP_A_SOCKET;
@@ -178,7 +178,7 @@ void pop_apop_timestamp (POP_DATA * pop_data, char *buf)
 
   if ((p1 = strchr (buf, '<')) && (p2 = strchr (p1, '>'))) {
     p2[1] = '\0';
-    pop_data->timestamp = safe_strdup (p1);
+    pop_data->timestamp = str_dup (p1);
   }
 }
 
@@ -310,7 +310,7 @@ pop_query_status pop_authenticate (POP_DATA * pop_data)
 
   if (PopAuthenticators && *PopAuthenticators) {
     /* Try user-specified list of authentication methods */
-    methods = safe_strdup (PopAuthenticators);
+    methods = str_dup (PopAuthenticators);
     method = methods;
 
     while (method) {
index 024cbdc..2cd84f0 100644 (file)
@@ -40,7 +40,7 @@ int pop_parse_path (const char *path, ACCOUNT * acct)
   acct->port = POP_PORT;
   acct->type = M_ACCT_TYPE_POP;
 
-  c = safe_strdup (path);
+  c = str_dup (path);
   url_parse_ciss (&url, c);
 
   if (url.scheme == U_POP || url.scheme == U_POPS) {
@@ -65,7 +65,7 @@ void pop_error (POP_DATA * pop_data, char *msg)
   t = strchr (pop_data->err_msg, '\0');
   c = msg;
 
-  if (!safe_strncmp (msg, "-ERR ", 5)) {
+  if (!str_ncmp (msg, "-ERR ", 5)) {
     c2 = msg + 5;
     SKIPWS (c2);
 
@@ -87,7 +87,7 @@ static int fetch_capa (char *line, void *data)
     FREE (&pop_data->auth_list);
     c = line + 4;
     SKIPWS (c);
-    pop_data->auth_list = safe_strdup (c);
+    pop_data->auth_list = str_dup (c);
   }
 
   else if (!ascii_strncasecmp (line, "STLS", 4))
@@ -221,7 +221,7 @@ pop_query_status pop_connect (POP_DATA * pop_data)
 
   pop_data->status = POP_CONNECTED;
 
-  if (safe_strncmp (buf, "+OK", 3)) {
+  if (str_ncmp (buf, "+OK", 3)) {
     *pop_data->err_msg = '\0';
     pop_error (pop_data, buf);
     mutt_error ("%s", pop_data->err_msg);
@@ -412,7 +412,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 (!safe_strncmp (buf, "+OK", 3))
+  if (!str_ncmp (buf, "+OK", 3))
     return PQ_OK;
 
   pop_error (pop_data, buf);
@@ -492,7 +492,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 (!str_cmp (ctx->hdrs[i]->data, line)) {
       ctx->hdrs[i]->refno = index;
       break;
     }
index bee4690..122a6c8 100644 (file)
@@ -328,10 +328,10 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
       tmp = next;
     }
     else if ((WithCrypto & APPLICATION_PGP)
-             && (safe_strncmp ("Pgp:", tmp->data, 4) == 0       /* this is generated
+             && (str_ncmp ("Pgp:", tmp->data, 4) == 0       /* this is generated
                                                                  * by old mutt versions
                                                                  */
-                 || safe_strncmp ("X-Mutt-PGP:", tmp->data, 11) == 0)) {
+                 || str_ncmp ("X-Mutt-PGP:", tmp->data, 11) == 0)) {
       hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1);
       hdr->security |= APPLICATION_PGP;
 
@@ -346,7 +346,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
       tmp = next;
     }
     else if ((WithCrypto & APPLICATION_SMIME)
-             && safe_strncmp ("X-Mutt-SMIME:", tmp->data, 13) == 0) {
+             && str_ncmp ("X-Mutt-SMIME:", tmp->data, 13) == 0) {
       hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1);
       hdr->security |= APPLICATION_SMIME;
 
@@ -362,7 +362,7 @@ int mutt_get_postponed (CONTEXT * ctx, HEADER * hdr, HEADER ** cur, char *fcc,
     }
 
 #ifdef MIXMASTER
-    else if (safe_strncmp ("X-Mutt-Mix:", tmp->data, 11) == 0) {
+    else if (str_ncmp ("X-Mutt-Mix:", tmp->data, 11) == 0) {
       char *t;
 
       mutt_free_list (&hdr->chain);
@@ -606,7 +606,7 @@ int mutt_prepare_template (FILE * fp, CONTEXT * ctx, HEADER * newhdr,
     file[0] = '\0';
     if (b->filename) {
       strfcpy (file, b->filename, sizeof (file));
-      b->d_filename = safe_strdup (b->filename);
+      b->d_filename = str_dup (b->filename);
     }
     else {
       /* avoid Content-Disposition: header with temporary filename */
diff --git a/query.c b/query.c
index 35dbf2b..ea5fc89 100644 (file)
--- a/query.c
+++ b/query.c
@@ -62,7 +62,7 @@ static ADDRESS *result_to_addr (QUERY * r)
   tmp = rfc822_cpy_adr (r->addr);
 
   if (!tmp->next && !tmp->personal)
-    tmp->personal = safe_strdup (r->name);
+    tmp->personal = str_dup (r->name);
 
   mutt_addrlist_to_idna (tmp, NULL);
   return tmp;
@@ -118,10 +118,10 @@ static QUERY *run_query (char *s, int quiet)
         l = mutt_strwidth (p);
         if (l > FirstColumn)
           FirstColumn = l;
-        cur->name = safe_strdup (p);
+        cur->name = str_dup (p);
         p = strtok (NULL, "\t\n");
         if (p) {
-          cur->other = safe_strdup (p);
+          cur->other = str_dup (p);
         }
       }
     }
@@ -185,7 +185,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);
+                      str_len (table[num].data->name), 0);
 
   snprintf (s, slen, " %c %3d %s %-*.*s %s",
             table[num].tagged ? '*' : ' ',
@@ -444,7 +444,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 = str_len (buf);
             rfc822_free_address (&tmpa);
           }
           else if (curpos + 2 < buflen) {
@@ -454,7 +454,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 = str_len (buf);
             rfc822_free_address (&tmpa);
           }
         }
index b9237f8..69614ed 100644 (file)
@@ -95,11 +95,11 @@ void mutt_update_tree (ATTACHPTR ** idx, short idxlen)
     }
 
     if (idx[x]->tree) {
-      if (mutt_strcmp (idx[x]->tree, buf) != 0)
+      if (str_cmp (idx[x]->tree, buf) != 0)
         str_replace (&idx[x]->tree, buf);
     }
     else
-      idx[x]->tree = safe_strdup (buf);
+      idx[x]->tree = str_dup (buf);
 
     if (2 * (idx[x]->level + 2) < sizeof (buf) && idx[x]->level) {
       s = buf + 2 * (idx[x]->level - 1);
@@ -1175,7 +1175,7 @@ void mutt_view_attachments (HEADER * hdr)
       CHECK_ATTACH;
 
       if (!idx[menu->current]->content->hdr->env->followup_to ||
-          safe_strcasecmp (idx[menu->current]->content->hdr->env->followup_to,
+          str_casecmp (idx[menu->current]->content->hdr->env->followup_to,
                            "poster")
           || query_quadoption (OPT_FOLLOWUPTOPOSTER,
                                _("Reply by mail as poster prefers?")) !=
index e6d54f9..f7b93d7 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -169,10 +169,10 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr,
     mutt_format_string (prompt, sizeof (prompt) - 4,
                         0, COLS - extra_space, 0, 0,
                         prompt, sizeof (prompt), 0);
-    safe_strcat (prompt, sizeof (prompt), "...?");
+    str_cat (prompt, sizeof (prompt), "...?");
   }
   else
-    safe_strcat (prompt, sizeof (prompt), "?");
+    str_cat (prompt, sizeof (prompt), "?");
 
   if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
     rfc822_free_address (&adr);
@@ -683,8 +683,8 @@ 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 &&
-        safe_strcasecmp (curenv->followup_to, "poster"))
-      env->newsgroups = safe_strdup (curenv->followup_to);
+        str_casecmp (curenv->followup_to, "poster"))
+      env->newsgroups = str_dup (curenv->followup_to);
   }
   else
 #endif
index 68de837..783ee59 100644 (file)
@@ -155,7 +155,7 @@ static REMAILER **mix_type2_list (size_t * l)
   /* first, generate the "random" remailer */
 
   p = mix_new_remailer ();
-  p->shortname = safe_strdup ("<random>");
+  p->shortname = str_dup ("<random>");
   mix_add_entry (&type2_list, p, &slots, &used);
 
   while (fgets (line, sizeof (line), fp)) {
@@ -164,12 +164,12 @@ static REMAILER **mix_type2_list (size_t * l)
     if (!(t = strtok (line, " \t\n")))
       goto problem;
 
-    p->shortname = safe_strdup (t);
+    p->shortname = str_dup (t);
 
     if (!(t = strtok (NULL, " \t\n")))
       goto problem;
 
-    p->addr = safe_strdup (t);
+    p->addr = str_dup (t);
 
     if (!(t = strtok (NULL, " \t\n")))
       goto problem;
@@ -177,7 +177,7 @@ static REMAILER **mix_type2_list (size_t * l)
     if (!(t = strtok (NULL, " \t\n")))
       goto problem;
 
-    p->ver = safe_strdup (t);
+    p->ver = str_dup (t);
 
     if (!(t = strtok (NULL, " \t\n")))
       goto problem;
@@ -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 + str_len (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 += str_len (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 (!str_cmp (s, "0") || !ascii_strcasecmp (s, "<random>")) {
     chain->ch[chain->cl++] = 0;
     return 0;
   }
index 220beeb..6b5eeae 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -194,14 +194,14 @@ 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 */
+                                                                                    str_cmp (buf + btlen, "/*"))))  /* wildsubtype */
         continue;
 
       /* next field is the viewcommand */
       field = ch;
       ch = get_field (ch);
       if (entry)
-        entry->command = safe_strdup (field);
+        entry->command = str_dup (field);
 
       /* parse the optional fields */
       found = TRUE;
@@ -265,7 +265,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 = str_len (test_command) + STRING;
             safe_realloc (&test_command, len);
             rfc1524_expand_command (a, a->filename, type, test_command, len);
             if (mutt_system (test_command)) {
@@ -473,8 +473,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 = str_len (oldfile) - 1, k =
+           str_len (nametemplate) - 1;
            j >= (lmatch ? i : 0) && k >= i + 2; j--, k--) {
         if (nametemplate[k] != oldfile[j]) {
           rmatch = 0;
index c8c1bea..333667c 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       /* str_len ("=?.?.?.?=") */
 
 #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 : str_len (p);
 
     if (!n ||
         /* Assume that we never need more than 12 characters of
@@ -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, str_len (tocode)), s += str_len (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, str_len (tocode)), s += str_len (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) - str_len (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) - str_len (tocode))
+      return sizeof (buf1) - str_len (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 + str_len (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) - str_len (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 + str_len (LINEBREAK) > buflen) {
+      buflen = bufpos + wlen + str_len (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, str_len (LINEBREAK));
+    bufpos += str_len (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, str_len (*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 ? str_len (tag) + 2 : 32;
 
   while (ptr) {
     if (ptr->personal)
@@ -555,7 +555,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 (str_len (s));
 
   for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) {
     count++;
@@ -711,14 +711,14 @@ void rfc2047_decode (char **pd)
   if (!s || !*s)
     return;
 
-  dlen = 4 * mutt_strlen (s);        /* should be enough */
+  dlen = 4 * str_len (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 = str_len (s);
         if (found_encoded && (m = lwslen (s, n)) != 0) {
           if (m != n)
             *d = ' ', d++, dlen--;
@@ -731,7 +731,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 = str_len (t);
             strncpy (d, t, tlen);
             d += tlen;
           }
@@ -781,7 +781,7 @@ void rfc2047_decode (char **pd)
     rfc2047_decode_word (d, p, dlen);
     found_encoded = 1;
     s = q;
-    n = mutt_strlen (d);
+    n = str_len (d);
     dlen -= n;
     d += n;
   }
index 0fcc857..f7caea1 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 = str_cmp (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 = str_len (par->value);
 
       safe_realloc (&value, l + vl + 1);
       strcpy (value + l, par->value);   /* __STRCPY_CHECKED__ */
@@ -279,13 +279,13 @@ 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 && !str_cmp (par->attribute, attribute));
 
     if (value) {
       if (encoded)
         mutt_convert_string (&value, charset, Charset, M_ICONV_HOOK_FROM);
       *head = mutt_new_parameter ();
-      (*head)->attribute = safe_strdup (attribute);
+      (*head)->attribute = str_dup (attribute);
       (*head)->value = value;
       head = &(*head)->next;
     }
@@ -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))) {
-    charset = safe_strdup (Charset ? Charset : "unknown-8bit");
+                                       *pd, str_len (*pd), &d, &dlen))) {
+    charset = str_dup (Charset ? Charset : "unknown-8bit");
     d = *pd;
-    dlen = mutt_strlen (d);
+    dlen = str_len (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 + str_len (charset) + 3);
     sprintf (e, "%s''", charset);       /* __SPRINTF_CHECKED__ */
-    t = e + mutt_strlen (e);
+    t = e + str_len (e);
     for (s = d, slen = dlen; slen; s++, slen--)
       if (*s < 0x20 || *s >= 0x7f ||
           strchr (MimeSpecials, *s) || strchr ("*'%", *s)) {
index 19fb086..618e37b 100644 (file)
--- a/rfc822.c
+++ b/rfc822.c
@@ -205,11 +205,11 @@ static const char *parse_address (const char *s,
   }
 
   terminate_string (token, *tokenlen, tokenmax);
-  addr->mailbox = safe_strdup (token);
+  addr->mailbox = str_dup (token);
 
   if (*commentlen && !addr->personal) {
     terminate_string (comment, *commentlen, commentmax);
-    addr->personal = safe_strdup (comment);
+    addr->personal = str_dup (comment);
   }
 
   return s;
@@ -254,7 +254,7 @@ static const char *parse_route_addr (const char *s,
   }
 
   if (!addr->mailbox)
-    addr->mailbox = safe_strdup ("@");
+    addr->mailbox = str_dup ("@");
 
   s++;
   return s;
@@ -322,7 +322,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
       }
       else if (commentlen && last && !last->personal) {
         terminate_buffer (comment, commentlen);
-        last->personal = safe_strdup (comment);
+        last->personal = str_dup (comment);
       }
 
       commentlen = 0;
@@ -345,7 +345,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
     else if (*s == ':') {
       cur = rfc822_new_address ();
       terminate_buffer (phrase, phraselen);
-      cur->mailbox = safe_strdup (phrase);
+      cur->mailbox = str_dup (phrase);
       cur->group = 1;
 
       if (last)
@@ -368,7 +368,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
       }
       else if (commentlen && last && !last->personal) {
         terminate_buffer (comment, commentlen);
-        last->personal = safe_strdup (comment);
+        last->personal = str_dup (comment);
       }
 
       /* add group terminator */
@@ -392,7 +392,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
           FREE (&cur->personal);
         /* if we get something like "Michael R. Elkins" remove the quotes */
         rfc822_dequote_comment (phrase);
-        cur->personal = safe_strdup (phrase);
+        cur->personal = str_dup (phrase);
       }
       if ((ps =
            parse_route_addr (s + 1, comment, &commentlen,
@@ -434,7 +434,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
   }
   else if (commentlen && last && !last->personal) {
     terminate_buffer (comment, commentlen);
-    last->personal = safe_strdup (comment);
+    last->personal = str_dup (comment);
   }
 
   return top;
@@ -446,7 +446,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 (str_len (addr->mailbox) + str_len (host) + 2);
       sprintf (p, "%s@%s", addr->mailbox, host);        /* __SPRINTF_CHECKED__ */
       FREE (&addr->mailbox);
       addr->mailbox = p;
@@ -516,7 +516,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 = str_len (pbuf);
       pbuf += len;
       buflen -= len;
     }
@@ -539,11 +539,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 = str_len (pbuf);
     }
     else if (ascii_strcmp (addr->mailbox, "@") && display) {
       strfcpy (pbuf, mutt_addr_for_display (addr), buflen);
-      len = mutt_strlen (pbuf);
+      len = str_len (pbuf);
     }
     else {
       *pbuf = '\0';
@@ -587,7 +587,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 = str_len (buf);
 
   buflen--;                     /* save room for the terminal nul */
 
@@ -614,7 +614,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 = str_len (pbuf);
     pbuf += len;
     buflen -= len;
 
@@ -640,8 +640,8 @@ ADDRESS *rfc822_cpy_adr_real (ADDRESS * addr)
 {
   ADDRESS *p = rfc822_new_address ();
 
-  p->personal = safe_strdup (addr->personal);
-  p->mailbox = safe_strdup (addr->mailbox);
+  p->personal = str_dup (addr->personal);
+  p->mailbox = str_dup (addr->mailbox);
   p->group = addr->group;
   return p;
 }
diff --git a/score.c b/score.c
index fba01f8..1c442ec 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 (str_cmp (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 (!str_cmp ("*", 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 (!str_cmp (buf->data, tmp->str)) {
           if (last)
             last->next = tmp->next;
           else
diff --git a/send.c b/send.c
index d777335..fd4bf77 100644 (file)
--- a/send.c
+++ b/send.c
@@ -214,7 +214,7 @@ static int edit_envelope (ENVELOPE * en, int flags)
     if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0)
       return (-1);
     FREE (&en->newsgroups);
-    en->newsgroups = safe_strdup (buf);
+    en->newsgroups = str_dup (buf);
 
     if (en->followup_to)
       strfcpy (buf, en->followup_to, sizeof (buf));
@@ -224,7 +224,7 @@ static int edit_envelope (ENVELOPE * en, int flags)
         && mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0)
       return (-1);
     FREE (&en->followup_to);
-    en->followup_to = safe_strdup (buf);
+    en->followup_to = str_dup (buf);
 
     if (en->x_comment_to)
       strfcpy (buf, en->x_comment_to, sizeof (buf));
@@ -234,7 +234,7 @@ static int edit_envelope (ENVELOPE * en, int flags)
         && mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0)
       return (-1);
     FREE (&en->x_comment_to);
-    en->x_comment_to = safe_strdup (buf);
+    en->x_comment_to = str_dup (buf);
   }
   else
 #endif
@@ -300,7 +300,7 @@ static int edit_envelope (ENVELOPE * en, int flags)
 char *nntp_get_header (const char *s)
 {
   SKIPWS (s);
-  return safe_strdup (s);
+  return str_dup (s);
 }
 #endif
 
@@ -363,7 +363,7 @@ static void process_user_header (ENVELOPE * env)
       }
       else
         last = env->userhdrs = mutt_new_list ();
-      last->data = safe_strdup (uh->data);
+      last->data = str_dup (uh->data);
     }
   }
 }
@@ -374,7 +374,7 @@ LIST *mutt_copy_list (LIST * p)
 
   for (; p; p = p->next) {
     t = (LIST *) safe_malloc (sizeof (LIST));
-    t->data = safe_strdup (p->data);
+    t->data = str_dup (p->data);
     t->next = NULL;
     if (l) {
       r->next = t;
@@ -617,7 +617,7 @@ LIST *mutt_make_references (ENVELOPE * e)
 
   if (e->message_id) {
     t = mutt_new_list ();
-    t->data = safe_strdup (e->message_id);
+    t->data = str_dup (e->message_id);
     t->next = l;
     l = t;
   }
@@ -660,15 +660,15 @@ 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 (str_len (curenv->real_subj) + 5);
     sprintf (env->subject, "Re: %s", curenv->real_subj);        /* __SPRINTF_CHECKED__ */
   }
   else if (!env->subject)
-    env->subject = safe_strdup ("Re: your mail");
+    env->subject = str_dup ("Re: your mail");
 
 #ifdef USE_NNTP
   if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from)
-    env->x_comment_to = safe_strdup (mutt_get_name (curenv->from));
+    env->x_comment_to = str_dup (mutt_get_name (curenv->from));
 #endif
 }
 
@@ -696,7 +696,7 @@ void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
 
   if (curenv->message_id) {
     *q = mutt_new_list ();
-    (*q)->data = safe_strdup (curenv->message_id);
+    (*q)->data = str_dup (curenv->message_id);
   }
 
   if (pp)
@@ -759,8 +759,8 @@ 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 &&
-          safe_strcasecmp (curenv->followup_to, "poster"))
-        env->newsgroups = safe_strdup (curenv->followup_to);
+          str_casecmp (curenv->followup_to, "poster"))
+        env->newsgroups = str_dup (curenv->followup_to);
     }
     else
 #endif
@@ -903,7 +903,7 @@ void mutt_set_followup_to (ENVELOPE * e)
 #ifdef USE_NNTP
   if (option (OPTNEWSSEND)) {
     if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ',')))
-      e->followup_to = safe_strdup (e->newsgroups);
+      e->followup_to = str_dup (e->newsgroups);
     return;
   }
 #endif
@@ -976,7 +976,7 @@ static ADDRESS *set_reverse_name (ENVELOPE * env)
     if (!option (OPTREVREAL))
       FREE (&tmp->personal);
     if (!tmp->personal)
-      tmp->personal = safe_strdup (Realname);
+      tmp->personal = str_dup (Realname);
   }
   return (tmp);
 }
@@ -996,12 +996,12 @@ 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 (str_len (Username) + str_len (fqdn) + 2);
     sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn));  /* __SPRINTF_CHECKED__ */
   }
   else {
     adr = rfc822_new_address ();
-    adr->mailbox = safe_strdup (NONULL (Username));
+    adr->mailbox = str_dup (NONULL (Username));
   }
 
   return (adr);
@@ -1135,7 +1135,7 @@ int ci_send_message (int flags, /* send mode */
 
 
   if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED))
-    signas = safe_strdup (PgpSignAs);
+    signas = str_dup (PgpSignAs);
 
   /* Delay expansion of aliases until absolutely necessary--shouldn't
    * be necessary unless we are prompting the user or about to execute a
@@ -1201,11 +1201,11 @@ int ci_send_message (int flags, /* send mode */
     if (!tempfile) {
       mutt_mktemp (buffer);
       tempfp = safe_fopen (buffer, "w+");
-      msg->content->filename = safe_strdup (buffer);
+      msg->content->filename = str_dup (buffer);
     }
     else {
       tempfp = safe_fopen (tempfile, "a+");
-      msg->content->filename = safe_strdup (tempfile);
+      msg->content->filename = str_dup (tempfile);
     }
 
     if (!tempfp) {
@@ -1259,7 +1259,7 @@ int ci_send_message (int flags, /* send mode */
 #ifdef USE_NNTP
     if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP
         && !msg->env->newsgroups)
-      msg->env->newsgroups = safe_strdup (((NNTP_DATA *) ctx->data)->group);
+      msg->env->newsgroups = str_dup (((NNTP_DATA *) ctx->data)->group);
 #endif
 
     if (!(flags & SENDMAILX) &&
@@ -1314,7 +1314,7 @@ int ci_send_message (int flags, /* send mode */
 
     if (option (OPTSIGONTOP)
         && (!(flags & (SENDMAILX | SENDKEY)) && Editor
-            && mutt_strcmp (Editor, "builtin") != 0))
+            && str_cmp (Editor, "builtin") != 0))
       append_signature (tempfp);
 
     /* include replies/forwarded messages, unless we are given a template */
@@ -1324,7 +1324,7 @@ int ci_send_message (int flags, /* send mode */
 
     if (!option (OPTSIGONTOP)
         && (!(flags & (SENDMAILX | SENDKEY)) && Editor
-            && mutt_strcmp (Editor, "builtin") != 0))
+            && str_cmp (Editor, "builtin") != 0))
       append_signature (tempfp);
 
     /* 
@@ -1404,7 +1404,7 @@ int ci_send_message (int flags, /* send mode */
      that $realname can be set in a send-hook */
   if (msg->env->from && !msg->env->from->personal
       && !(flags & (SENDRESEND | SENDPOSTPONED)))
-    msg->env->from->personal = safe_strdup (Realname);
+    msg->env->from->personal = str_dup (Realname);
 
   if (!((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)))
     safe_fclose (&tempfp);
@@ -1437,7 +1437,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 || str_cmp ("builtin", Editor) == 0)
         mutt_builtin_editor (msg->content->filename, msg, cur);
       else if (option (OPTEDITHDRS)) {
         mutt_env_to_local (msg->env);
@@ -1665,7 +1665,7 @@ int ci_send_message (int flags, /* send mode */
     fcc[0] = '\0';
 #endif
 
-  if (*fcc && mutt_strcmp ("/dev/null", fcc) != 0) {
+  if (*fcc && str_cmp ("/dev/null", fcc) != 0) {
     BODY *tmpbody = msg->content;
     BODY *save_sig = NULL;
     BODY *save_parts = NULL;
@@ -1676,8 +1676,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)) {
+          && (str_cmp (msg->content->subtype, "encrypted") == 0 ||
+              str_cmp (msg->content->subtype, "signed") == 0)) {
         if (clear_content->type == TYPEMULTIPART) {
           if (!(msg->security & ENCRYPT) && (msg->security & SIGN)) {
             /* save initial signature and attachments */
index 226715b..629e197 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -116,11 +116,11 @@ static void encode_quoted (FGETCONV * fc, FILE * fout, int istext)
     }
 
     /* Escape lines that begin with/only contain "the message separator". */
-    if (linelen == 4 && !safe_strncmp ("From", line, 4)) {
+    if (linelen == 4 && !str_ncmp ("From", line, 4)) {
       strfcpy (line, "=46rom", sizeof (line));
       linelen = 6;
     }
-    else if (linelen == 4 && !safe_strncmp ("from", line, 4)) {
+    else if (linelen == 4 && !str_ncmp ("from", line, 4)) {
       strfcpy (line, "=66rom", sizeof (line));
       linelen = 6;
     }
@@ -291,7 +291,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 + str_len (a->subtype);        /* approximate len. of content-type */
 
     for (p = a->parameter; p; p = p->next) {
       char *tmp;
@@ -302,7 +302,7 @@ int mutt_write_mime_header (BODY * a, FILE * f)
       fputc (';', f);
 
       buffer[0] = 0;
-      tmp = safe_strdup (p->value);
+      tmp = str_dup (p->value);
       encode = rfc2231_encode_string (&tmp);
       rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials);
 
@@ -317,7 +317,7 @@ int mutt_write_mime_header (BODY * a, FILE * f)
 
       FREE (&tmp);
 
-      tmplen = mutt_strlen (buffer) + mutt_strlen (p->attribute) + 1;
+      tmplen = str_len (buffer) + str_len (p->attribute) + 1;
 
       if (len + tmplen + 2 > 76) {
         fputs ("\n\t", f);
@@ -354,7 +354,7 @@ int mutt_write_mime_header (BODY * a, FILE * f)
         t = fn;
 
       buffer[0] = 0;
-      tmp = safe_strdup (t);
+      tmp = str_dup (t);
       encode = rfc2231_encode_string (&tmp);
       rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials);
       FREE (&tmp);
@@ -408,7 +408,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) {
+      && str_cmp (a->subtype, "pgp-encrypted") == 0) {
     fputs ("Version: 1\n", f);
     return 0;
   }
@@ -887,7 +887,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path)
   type = TYPEOTHER;
   cur_sze = 0;
 
-  szf = mutt_strlen (path);
+  szf = str_len (path);
 
   for (count = 0; count < 3; count++) {
     /*
@@ -927,9 +927,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 = str_len (p);
           if ((sze > cur_sze) && (szf >= sze) &&
-              (safe_strcasecmp (path + szf - sze, p) == 0
+              (str_casecmp (path + szf - sze, p) == 0
                || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze
                                                                    || path[szf
                                                                            -
@@ -1028,7 +1028,7 @@ cleanup:
   a->d_filename = a->filename;
   if (a->filename && a->unlink)
     unlink (a->filename);
-  a->filename = safe_strdup (temp);
+  a->filename = str_dup (temp);
   a->unlink = 1;
   if (stat (a->filename, &sb) == -1) {
     mutt_perror ("stat");
@@ -1069,7 +1069,7 @@ static void transform_to_7bit (BODY * a, FILE * fpin)
       mutt_decode_attachment (a, &s);
       fclose (s.fpout);
       a->d_filename = a->filename;
-      a->filename = safe_strdup (buff);
+      a->filename = str_dup (buff);
       a->unlink = 1;
       if (stat (a->filename, &sb) == -1) {
         mutt_perror ("stat");
@@ -1206,8 +1206,8 @@ BODY *mutt_make_message_attach (CONTEXT * ctx, HEADER * hdr, int attach_msg)
 
   body = mutt_new_body ();
   body->type = TYPEMESSAGE;
-  body->subtype = safe_strdup ("rfc822");
-  body->filename = safe_strdup (buffer);
+  body->subtype = str_dup ("rfc822");
+  body->filename = str_dup (buffer);
   body->unlink = 1;
   body->use_disp = 0;
   body->disposition = DISPINLINE;
@@ -1273,7 +1273,7 @@ BODY *mutt_make_file_attach (const char *path)
   CONTENT *info;
 
   att = mutt_new_body ();
-  att->filename = safe_strdup (path);
+  att->filename = str_dup (path);
 
   /* Attempt to determine the appropriate content-type based on the filename
    * suffix.
@@ -1285,8 +1285,8 @@ BODY *mutt_make_file_attach (const char *path)
        mutt_lookup_mime_type (buf, sizeof (buf), xbuf, sizeof (xbuf),
                               path)) != TYPEOTHER || *xbuf != '\0') {
     att->type = n;
-    att->subtype = safe_strdup (buf);
-    att->xtype = safe_strdup (xbuf);
+    att->subtype = str_dup (buf);
+    att->xtype = str_dup (xbuf);
   }
 
 #else
@@ -1308,11 +1308,11 @@ BODY *mutt_make_file_attach (const char *path)
        * chars if this is really a binary file...
        */
       att->type = TYPETEXT;
-      att->subtype = safe_strdup ("plain");
+      att->subtype = str_dup ("plain");
     }
     else {
       att->type = TYPEAPPLICATION;
-      att->subtype = safe_strdup ("octet-stream");
+      att->subtype = str_dup ("octet-stream");
     }
   }
 
@@ -1340,7 +1340,7 @@ BODY *mutt_make_multipart (BODY * b)
 
   new = mutt_new_body ();
   new->type = TYPEMULTIPART;
-  new->subtype = safe_strdup ("mixed");
+  new->subtype = str_dup ("mixed");
   new->encoding = get_toplevel_encoding (b);
   mutt_generate_boundary (&new->parameter);
   new->use_disp = 0;
@@ -1394,7 +1394,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 = str_len (buf);
     if (count && linelen + len > 74) {
       fputs ("\n\t", fp);
       linelen = len + 8;        /* tab is usually about 8 spaces... */
@@ -1631,14 +1631,14 @@ static void encode_headers (LIST * h)
     i = p - h->data;
     ++p;
     SKIPWS (p);
-    tmp = safe_strdup (p);
+    tmp = str_dup (p);
 
     if (!tmp)
       continue;
 
     rfc2047_encode_string (&tmp);
     safe_realloc (&h->data,
-                  mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1);
+                  str_len (h->data) + 2 + str_len (tmp) + 1);
 
     sprintf (h->data + i, ": %s", NONULL (tmp));        /* __SPRINTF_CHECKED__ */
 
@@ -1696,62 +1696,62 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt)
         return;
       case 'd':
         snprintf (tmp, sizeof (tmp), "%02d", tm->tm_mday);
-        safe_strncat (buf, len, tmp, 2);
+        str_ncat (buf, len, tmp, 2);
         break;
       case 'h':
         snprintf (tmp, sizeof (tmp), "%02d", tm->tm_hour);
-        safe_strncat (buf, len, tmp, 2);
+        str_ncat (buf, len, tmp, 2);
         break;
       case 'm':
         snprintf (tmp, sizeof (tmp), "%02d", tm->tm_mon + 1);
-        safe_strncat (buf, len, tmp, 2);
+        str_ncat (buf, len, tmp, 2);
         break;
       case 'M':
         snprintf (tmp, sizeof (tmp), "%02d", tm->tm_min);
-        safe_strncat (buf, len, tmp, 2);
+        str_ncat (buf, len, tmp, 2);
         break;
       case 'O':
         snprintf (tmp, sizeof (tmp), "%lo", (unsigned long) now);
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        str_ncat (buf, len, tmp, str_len (tmp));
         break;
       case 'p':
         snprintf (tmp, sizeof (tmp), "%u", (unsigned int) getpid ());
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        str_ncat (buf, len, tmp, str_len (tmp));
         break;
       case 'P':
         snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx);
         MsgIdPfx = (MsgIdPfx == 'Z') ? 'A' : MsgIdPfx + 1;
-        safe_strncat (buf, len, tmp, 1);
+        str_ncat (buf, len, tmp, 1);
         break;
       case 'r':
         snprintf (tmp, sizeof (tmp), "%u", (unsigned int) rand ());
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        str_ncat (buf, len, tmp, str_len (tmp));
         break;
       case 'R':
         snprintf (tmp, sizeof (tmp), "%x", (unsigned int) rand ());
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        str_ncat (buf, len, tmp, str_len (tmp));
         break;
       case 's':
         snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec);
-        safe_strncat (buf, len, tmp, 2);
+        str_ncat (buf, len, tmp, 2);
         break;
       case 'T':
         snprintf (tmp, sizeof (tmp), "%u", (unsigned int) now);
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        str_ncat (buf, len, tmp, str_len (tmp));
         break;
       case 'X':
         snprintf (tmp, sizeof (tmp), "%x", (unsigned int) now);
-        safe_strncat (buf, len, tmp, mutt_strlen (tmp));
+        str_ncat (buf, len, tmp, str_len (tmp));
         break;
       case 'Y':
         snprintf (tmp, sizeof (tmp), "%04d", tm->tm_year + 1900);       /* this will break in the year 10000 ;-) */
-        safe_strncat (buf, len, tmp, 4);
+        str_ncat (buf, len, tmp, 4);
         break;
       case '%':
-        safe_strncat (buf, len, "%", 1);
+        str_ncat (buf, len, "%", 1);
         break;
       default:
-        safe_strncat (buf, len, ".", 1);        /* invalid formats are replaced by '.' */
+        str_ncat (buf, len, ".", 1);        /* invalid formats are replaced by '.' */
       }                         /* switch */
       ++fmt;
     }
@@ -1759,7 +1759,7 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt)
       char c;
 
       c = mutt_normalized_char (*fmt);  /* @todo: filter out invalid characters */
-      safe_strncat (buf, len, &c, 1);
+      str_ncat (buf, len, &c, 1);
     }
   }
 }
@@ -1774,12 +1774,12 @@ 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) - str_len (fqdn) - 4;  /* the 4 characters are '<', '@', '>' and '\0' */
 
   mutt_gen_localpart (localpart, localpart_length, MsgIdFormat);
 
   snprintf (buf, sizeof (buf), "<%s@%s>", localpart, fqdn);
-  return (safe_strdup (buf));
+  return (str_dup (buf));
 }
 
 static RETSIGTYPE alarm_handler (int sig)
@@ -1812,7 +1812,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile)
     char tmp[_POSIX_PATH_MAX];
 
     mutt_mktemp (tmp);
-    *tempfile = safe_strdup (tmp);
+    *tempfile = str_dup (tmp);
   }
 
   if ((pid = fork ()) == 0) {
@@ -1978,11 +1978,11 @@ static int mutt_invoke_sendmail (ADDRESS * from,        /* the sender */
       return i;
     }
 
-    s = safe_strdup (cmd);
+    s = str_dup (cmd);
   }
   else
 #endif
-    s = safe_strdup (Sendmail);
+    s = str_dup (Sendmail);
 
   ps = s;
   i = 0;
@@ -1993,7 +1993,7 @@ static int mutt_invoke_sendmail (ADDRESS * from,        /* the sender */
     if (i)
       args[argslen++] = ps;
     else {
-      path = safe_strdup (ps);
+      path = str_dup (ps);
       ps = strrchr (ps, '/');
       if (ps)
         ps++;
@@ -2086,9 +2086,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 = str_len (a);
 
-  safe_realloc (&a, la + mutt_strlen (b) + 1);
+  safe_realloc (&a, la + str_len (b) + 1);
   strcpy (a + la, b);           /* __STRCPY_CHECKED__ */
   return (a);
 }
@@ -2116,7 +2116,7 @@ char *mutt_quote_string (const char *s)
   char *r, *pr;
   size_t rlen;
 
-  rlen = mutt_strlen (s) + 3;
+  rlen = str_len (s) + 3;
   pr = r = (char *) safe_malloc (rlen);
   *pr++ = '"';
   while (*s) {
@@ -2153,7 +2153,7 @@ void mutt_prepare_envelope (ENVELOPE * env, int final)
       rfc822_cat (buffer, sizeof (buffer), "undisclosed-recipients",
                   RFC822Specials);
 
-      env->to->mailbox = safe_strdup (buffer);
+      env->to->mailbox = str_dup (buffer);
     }
 
     mutt_set_followup_to (env);
index 6fd5ce0..5df3fd8 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -64,11 +64,11 @@ static char *shortened_hierarchy (char *box, int maxlen)
 {
   int dots = 0;
   char *last_dot = NULL;
-  int i, j, len = mutt_strlen (box);
+  int i, j, len = str_len (box);
   char *new_box;
 
   if (!SidebarBoundary || !*SidebarBoundary)
-    return (safe_strdup (box));
+    return (str_dup (box));
 
   for (i = 0; i < len; ++i) {
     if (strchr (SidebarBoundary, box[i])) {
@@ -85,7 +85,7 @@ static char *shortened_hierarchy (char *box, int maxlen)
       if (strchr (SidebarBoundary, box[i])) {
         new_box[j++] = box[i];
         new_box[j] = 0;
-        if (&box[i + 1] != last_dot || j + mutt_strlen (last_dot) > maxlen) {
+        if (&box[i + 1] != last_dot || j + str_len (last_dot) > maxlen) {
           new_box[j++] = box[i + 1];
           new_box[j] = 0;
         } else {
@@ -96,7 +96,7 @@ static char *shortened_hierarchy (char *box, int maxlen)
     }
     return new_box;
   }
-  return safe_strdup (box);
+  return str_dup (box);
 }
 
 static const char* sidebar_number_format (char* dest, size_t destlen, char op,
@@ -187,7 +187,7 @@ int make_sidebar_entry (char* box, int idx, size_t len)
   int shortened = 0, lencnt = 0;
   char no[SHORT_STRING], entry[SHORT_STRING];
 #if USE_IMAP
-  int l = mutt_strlen (ImapHomeNamespace);
+  int l = str_len (ImapHomeNamespace);
 #endif
 
   if (SidebarWidth > COLS)
@@ -202,24 +202,24 @@ int make_sidebar_entry (char* box, int idx, size_t len)
 
   mutt_FormatString (no, len, NONULL (SidebarNumberFormat),
                      sidebar_number_format, idx, M_FORMAT_OPTIONAL);
-  lencnt = mutt_strlen (no);
+  lencnt = str_len (no);
   memset (&entry, ' ', sizeof (entry));
 
 #if USE_IMAP
-  if (l > 0 && safe_strncmp (box, ImapHomeNamespace, l) == 0 && 
-      mutt_strlen (box) > l)
+  if (l > 0 && str_ncmp (box, ImapHomeNamespace, l) == 0 && 
+      str_len (box) > l)
     box += l + 1;
   else
 #endif
     box = basename (box);
 
-  if (option (OPTSHORTENHIERARCHY) && mutt_strlen (box) > len-lencnt-1) {
+  if (option (OPTSHORTENHIERARCHY) && str_len (box) > len-lencnt-1) {
     box = shortened_hierarchy (box, len-lencnt-1);
     shortened = 1;
   }
 
   snprintf (entry, len-lencnt, "%s", box);
-  entry[mutt_strlen (entry)] = ' ';
+  entry[str_len (entry)] = ' ';
   strncpy (entry + (len - lencnt), no, lencnt);
 
   addnstr (entry, len);
@@ -269,7 +269,7 @@ int sidebar_draw (int menu)
 
   int lines = option (OPTHELP) ? 1 : 0, draw_devider = 1, i = 0;
   BUFFY *tmp;
-  short delim_len = mutt_strlen (SidebarDelim);
+  short delim_len = str_len (SidebarDelim);
   char blank[SHORT_STRING];
 
   /* initialize first time */
@@ -298,7 +298,7 @@ int sidebar_draw (int menu)
   }
 
   if (SidebarWidth > 0 && option (OPTMBOXPANE)
-      && mutt_strlen (SidebarDelim) >= SidebarWidth) {
+      && str_len (SidebarDelim) >= SidebarWidth) {
     mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
     sleep (2);
     unset_option (OPTMBOXPANE);
@@ -317,9 +317,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) && !str_cmp (SidebarDelim, "|"))
         addch (ACS_VLINE);
-      else if ((Charset_is_utf8) && !mutt_strcmp (SidebarDelim, "|"))
+      else if ((Charset_is_utf8) && !str_cmp (SidebarDelim, "|"))
         addstr ("\342\224\202");
       else
         addstr (NONULL (SidebarDelim));
diff --git a/smime.c b/smime.c
index 965f40a..ece2fd8 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -486,8 +486,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 ? str_len (mailbox) : 0;
+  query_len = query ? str_len (query) : 0;
 
   *key = '\0';
 
@@ -509,7 +509,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
     }
 
     while (fgets (buf, sizeof (buf) - 1, fp) != NULL)
-      if (mailbox && !(safe_strncasecmp (mailbox, buf, addr_len))) {
+      if (mailbox && !(str_ncasecmp (mailbox, buf, addr_len))) {
         numFields = sscanf (buf,
                             MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " "
                             MUTT_FORMAT (STRING) " " MUTT_FORMAT (STRING) " "
@@ -571,13 +571,13 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
 
         /* query = label: return certificate. */
         if (numFields >= 3 &&
-            !(safe_strncasecmp (query, fields[2], query_len))) {
+            !(str_ncasecmp (query, fields[2], query_len))) {
           ask = 0;
           strfcpy (key, fields[1], sizeof (key));
         }
         /* query = certificate: return intermediate certificate. */
         else if (numFields >= 4 &&
-                 !(safe_strncasecmp (query, fields[1], query_len))) {
+                 !(str_ncasecmp (query, fields[1], query_len))) {
           ask = 0;
           strfcpy (key, fields[3], sizeof (key));
         }
@@ -619,8 +619,8 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public,
 
   }
 
-  /* Note: safe_strdup ("") returns NULL. */
-  return safe_strdup (key);
+  /* Note: str_dup ("") returns NULL. */
+  return str_dup (key);
 }
 
 
@@ -646,7 +646,7 @@ void _smime_getkeys (char *mailbox)
   if (k) {
     /* the key used last time. */
     if (*SmimeKeyToUse &&
-        !safe_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1)) {
+        !str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) {
       FREE (&k);
       return;
     }
@@ -659,7 +659,7 @@ void _smime_getkeys (char *mailbox)
     snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s",
               NONULL (SmimeCertificates), k);
 
-    if (safe_strcasecmp (k, SmimeDefaultKey))
+    if (str_casecmp (k, SmimeDefaultKey))
       smime_void_passphrase ();
 
     FREE (&k);
@@ -667,8 +667,8 @@ void _smime_getkeys (char *mailbox)
   }
 
   if (*SmimeKeyToUse) {
-    if (!safe_strcasecmp (SmimeDefaultKey,
-                          SmimeKeyToUse + mutt_strlen (SmimeKeys) + 1))
+    if (!str_casecmp (SmimeDefaultKey,
+                          SmimeKeyToUse + str_len (SmimeKeys) + 1))
       return;
 
     smime_void_passphrase ();
@@ -770,10 +770,10 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc)
       return NULL;
     }
 
-    keylist_size += mutt_strlen (keyID) + 2;
+    keylist_size += str_len (keyID) + 2;
     safe_realloc (&keylist, keylist_size);
     sprintf (keylist + keylist_used, "%s\n", keyID);    /* __SPRINTF_CHECKED__ */
-    keylist_used = mutt_strlen (keylist);
+    keylist_used = str_len (keylist);
 
     rfc822_free_address (&addr);
 
@@ -830,8 +830,8 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
 
 
   while ((fgets (email, sizeof (email), fpout))) {
-    *(email + mutt_strlen (email) - 1) = '\0';
-    if (safe_strncasecmp (email, mailbox, mutt_strlen (mailbox)) == 0)
+    *(email + str_len (email) - 1) = '\0';
+    if (str_ncasecmp (email, mailbox, str_len (mailbox)) == 0)
       ret = 1;
 
     ret = ret < 0 ? 0 : ret;
@@ -857,9 +857,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 + str_len (email) - 1) = '\0';
+      (*buffer)[count] = safe_calloc (1, str_len (email) + 1);
+      strncpy ((*buffer)[count], email, str_len (email));
       count++;
     }
   }
@@ -975,7 +975,7 @@ static char *smime_extract_certificate (char *infile)
   fclose (fpout);
   fclose (fperr);
 
-  return safe_strdup (certfile);
+  return str_dup (certfile);
 }
 
 static char *smime_extract_signer_certificate (char *infile)
@@ -1037,7 +1037,7 @@ static char *smime_extract_signer_certificate (char *infile)
   fclose (fpout);
   fclose (fperr);
 
-  return safe_strdup (certfile);
+  return str_dup (certfile);
 }
 
 
@@ -1239,7 +1239,7 @@ BODY *smime_build_smime_entity (BODY * a, char *certlist)
 
   *certfile = '\0';
   while (1) {
-    int off = mutt_strlen (certfile);
+    int off = str_len (certfile);
 
     while (*++cert_end && *cert_end != '\n');
     if (!*cert_end)
@@ -1302,14 +1302,14 @@ BODY *smime_build_smime_entity (BODY * a, char *certlist)
 
   t = mutt_new_body ();
   t->type = TYPEAPPLICATION;
-  t->subtype = safe_strdup ("x-pkcs7-mime");
+  t->subtype = str_dup ("x-pkcs7-mime");
   mutt_set_parameter ("name", "smime.p7m", &t->parameter);
   mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter);
   t->encoding = ENCBASE64;      /* The output of OpenSSL SHOULD be binary */
   t->use_disp = 1;
   t->disposition = DISPATTACH;
-  t->d_filename = safe_strdup ("smime.p7m");
-  t->filename = safe_strdup (tempfile);
+  t->d_filename = str_dup ("smime.p7m");
+  t->filename = str_dup (tempfile);
   t->unlink = 1;                /*delete after sending the message */
   t->parts = 0;
   t->next = 0;
@@ -1418,7 +1418,7 @@ BODY *smime_sign_message (BODY * a)
 
   t = mutt_new_body ();
   t->type = TYPEMULTIPART;
-  t->subtype = safe_strdup ("signed");
+  t->subtype = str_dup ("signed");
   t->encoding = ENC7BIT;
   t->use_disp = 0;
   t->disposition = DISPINLINE;
@@ -1435,9 +1435,9 @@ BODY *smime_sign_message (BODY * a)
   t->parts->next = mutt_new_body ();
   t = t->parts->next;
   t->type = TYPEAPPLICATION;
-  t->subtype = safe_strdup ("x-pkcs7-signature");
-  t->filename = safe_strdup (signedfile);
-  t->d_filename = safe_strdup ("smime.p7s");
+  t->subtype = str_dup ("x-pkcs7-signature");
+  t->filename = str_dup (signedfile);
+  t->d_filename = str_dup ("smime.p7s");
   t->use_disp = 1;
   t->disposition = DISPATTACH;
   t->encoding = ENCBASE64;
@@ -1562,7 +1562,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
       rewind (smimeerr);
 
       line = mutt_read_line (line, &linelen, smimeerr, &lineno);
-      if (linelen && !safe_strcasecmp (line, "verification successful"))
+      if (linelen && !str_casecmp (line, "verification successful"))
         badsig = 0;
 
       FREE (&line);
@@ -1725,7 +1725,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 = str_len (buf);
       if (len > 1 && buf[len - 2] == '\r') {
         buf[len - 2] = '\n';
         buf[len - 1] = '\0';
@@ -1776,7 +1776,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
     rewind (smimeerr);
 
     line = mutt_read_line (line, &linelen, smimeerr, &lineno);
-    if (linelen && !safe_strcasecmp (line, "verification successful"))
+    if (linelen && !str_casecmp (line, "verification successful"))
       m->goodsig = 1;
     FREE (&line);
   }
@@ -1921,7 +1921,7 @@ 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';
+      p[str_len (p) - 1] = '\0';
       str_replace (&SmimeDefaultKey, p);
 
       msg->security |= SIGN;
index 036d904..fcfcbb7 100644 (file)
@@ -402,7 +402,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);       /* str_len */
   padlen = min - strln;
   if (padlen < 0)
     padlen = 0;
@@ -689,7 +689,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 (str_len (str));
 }
 #endif /* !HAVE_VSNPRINTF */
 
@@ -717,7 +717,7 @@ int snprintf (va_alist)
 
   (void) vsnprintf (str, count, fmt, ap);
   VA_END;
-  return (mutt_strlen (str));
+  return (str_len (str));
 }
 
 #ifdef TEST_SNPRINTF
@@ -768,7 +768,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 (str_cmp (buf1, buf2)) {
         printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
                 fp_fmt[x], buf1, buf2);
         fail++;
@@ -780,7 +780,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 (str_cmp (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 6235cc6..93ba2e4 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 = safe_strcasecmp ((*pa)->env->real_subj, (*pb)->env->real_subj);
+    rc = str_casecmp ((*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 = safe_strcasecmp (fa, fb);
+  result = str_casecmp (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 = safe_strcasecmp (fa, fb);
+  result = str_casecmp (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 (str_cmp (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 = str_cmp (aptr, bptr);
     if (result == 0)
       AUXSORT (result, a, b);
   }
index a6ba54b..5265a7c 100644 (file)
--- a/status.c
+++ b/status.c
@@ -241,7 +241,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 >= str_len (StChars))
         buf[0] = StChars[0];
       else
         buf[0] = StChars[i];
index 79c26c5..9920a4a 100644 (file)
--- a/strdup.c
+++ b/strdup.c
@@ -19,9 +19,9 @@ char *strdup (const char *s)
   if (s == NULL)
     return NULL;
 
-  if ((d = malloc (mutt_strlen (s) + 1)) == NULL)    /* __MEM_CHECKED__ */
+  if ((d = malloc (str_len (s) + 1)) == NULL)    /* __MEM_CHECKED__ */
     return NULL;
 
-  memcpy (d, s, mutt_strlen (s) + 1);
+  memcpy (d, s, str_len (s) + 1);
   return d;
 }
index d07f328..1ca956a 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 = str_cmp (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)
+          str_cmp (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,
+            || !str_cmp (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 = str_cmp (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 (str_cmp (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 (!safe_strcasecmp (ref->data, p->message->env->message_id)) {
+        if (!str_casecmp (ref->data, p->message->env->message_id)) {
           done = 1;
           break;
         }
@@ -1282,7 +1282,7 @@ static int link_threads (HEADER * parent, HEADER * child, CONTEXT * ctx)
   mutt_break_thread (child);
 
   child->env->in_reply_to = mutt_new_list ();
-  child->env->in_reply_to->data = safe_strdup (parent->env->message_id);
+  child->env->in_reply_to->data = str_dup (parent->env->message_id);
 
   mutt_set_flag (ctx, child, M_TAG, 0);
 
diff --git a/url.c b/url.c
index 35cb0c1..84c17a6 100644 (file)
--- a/url.c
+++ b/url.c
@@ -171,8 +171,8 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags)
   snprintf (dest, len, "%s:", mutt_getnamebyvalue (ciss->scheme, UrlMap));
 
   if (ciss->host) {
-    safe_strcat (dest, len, "//");
-    len -= (l = mutt_strlen (dest));
+    str_cat (dest, len, "//");
+    len -= (l = str_len (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 = str_len (dest));
       dest += l;
     }
 
@@ -192,7 +192,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags)
   }
 
   if (ciss->path)
-    safe_strcat (dest, len, ciss->path);
+    str_cat (dest, len, ciss->path);
 
   return 0;
 }
@@ -212,7 +212,7 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src)
   if (!(t = strchr (src, ':')))
     return -1;
 
-  if ((tmp = safe_strdup (t + 1)) == NULL)
+  if ((tmp = str_dup (t + 1)) == NULL)
     return -1;
 
   if ((headers = strchr (tmp, '?')))
@@ -238,7 +238,7 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src)
     }
     else {
 #define SAFEPFX (option (OPTSTRICTMAILTO) ? "" : "X-Mailto-")
-      taglen = mutt_strlen (tag) + mutt_strlen (SAFEPFX);
+      taglen = str_len (tag) + str_len (SAFEPFX);
       /* mutt_parse_rfc822_line makes some assumptions */
       snprintf (scratch, sizeof (scratch), "%s%s: %s", SAFEPFX, tag, value);
 #undef SAVEPFX