Nico Golde:
authornion <nion@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Tue, 22 Mar 2005 13:34:08 +0000 (13:34 +0000)
committernion <nion@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Tue, 22 Mar 2005 13:34:08 +0000 (13:34 +0000)
- converted strcmp functions to mutt internal functions where it makes sense. TODO makedoc.c.

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

crypt-gpgme.c
mutt_ssl_gnutls.c
regex.c
rfc2231.c
sidebar.c
snprintf.c
sort.c

index e53b6ee..4932abd 100644 (file)
@@ -1002,7 +1002,7 @@ static int show_sig_summary (unsigned long sum,
       state_attach_puts (": ", s);
       if (t0)
         state_attach_puts (t0, s);
       state_attach_puts (": ", s);
       if (t0)
         state_attach_puts (t0, s);
-      if (t1 && !(t0 && !strcmp (t0, t1))) {
+      if (t1 && !(t0 && !mutt_strcmp (t0, t1))) {
         if (t0)
           state_attach_puts (",", s);
         state_attach_puts (t1, s);
         if (t0)
           state_attach_puts (",", s);
         state_attach_puts (t1, s);
@@ -2479,7 +2479,7 @@ static int print_dn_part (FILE * fp, struct dn_array_s *dn, const char *key)
   int any = 0;
 
   for (; dn->key; dn++) {
   int any = 0;
 
   for (; dn->key; dn++) {
-    if (!strcmp (dn->key, key)) {
+    if (!mutt_strcmp (dn->key, key)) {
       if (any)
         fputs (" + ", fp);
       print_utf8 (fp, dn->value, mutt_strlen (dn->value));
       if (any)
         fputs (" + ", fp);
       print_utf8 (fp, dn->value, mutt_strlen (dn->value));
@@ -2505,7 +2505,7 @@ static void print_dn_parts (FILE * fp, struct dn_array_s *dn)
   /* now print the rest without any specific ordering */
   for (; dn->key; dn++) {
     for (i = 0; stdpart[i]; i++) {
   /* now print the rest without any specific ordering */
   for (; dn->key; dn++) {
     for (i = 0; stdpart[i]; i++) {
-      if (!strcmp (dn->key, stdpart[i]))
+      if (!mutt_strcmp (dn->key, stdpart[i]))
         break;
     }
     if (!stdpart[i]) {
         break;
     }
     if (!stdpart[i]) {
@@ -2979,7 +2979,7 @@ static void verify_key (crypt_key_t * key)
 
   k = key->kobj;
   gpgme_key_ref (k);
 
   k = key->kobj;
   gpgme_key_ref (k);
-  while ((s = k->chain_id) && k->subkeys && strcmp (s, k->subkeys->fpr)) {
+  while ((s = k->chain_id) && k->subkeys && mutt_strcmp (s, k->subkeys->fpr)) {
     putc ('\n', fp);
     err = gpgme_op_keylist_start (listctx, s, 0);
     gpgme_key_release (k);
     putc ('\n', fp);
     err = gpgme_op_keylist_start (listctx, s, 0);
     gpgme_key_release (k);
index 08aa1ea..91cba18 100644 (file)
@@ -26,6 +26,7 @@
 #include "mutt_regex.h"
 
 #include "lib/mem.h"
 #include "mutt_regex.h"
 
 #include "lib/mem.h"
+#include "lib/str.h"
 #include "lib/intl.h"
 
 typedef struct _tlssockdata {
 #include "lib/intl.h"
 
 typedef struct _tlssockdata {
@@ -411,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 (regexec (&preg, linestr, 3, pmatch, 0) == 0) {
           linestr[pmatch[1].rm_eo] = '\0';
           linestr[pmatch[2].rm_eo] = '\0';
-          if (strcmp (linestr + pmatch[1].rm_so, hostname) == 0 &&
-              strcmp (linestr + pmatch[2].rm_so, buf) == 0) {
+          if (mutt_strcmp (linestr + pmatch[1].rm_so, hostname) == 0 &&
+              mutt_strcmp (linestr + pmatch[2].rm_so, buf) == 0) {
             regfree (&preg);
             FREE(&linestr);
             fclose (fp);
             regfree (&preg);
             FREE(&linestr);
             fclose (fp);
diff --git a/regex.c b/regex.c
index f15550c..ddd4228 100644 (file)
--- a/regex.c
+++ b/regex.c
@@ -98,6 +98,7 @@
 #include "lisp.h"
 #include "buffer.h"
 #include "syntax.h"
 #include "lisp.h"
 #include "buffer.h"
 #include "syntax.h"
+#include "lib/str.h"
 
 #else /* not emacs */
 
 
 #else /* not emacs */
 
@@ -176,29 +177,29 @@ enum { MUTT_ALNUM =
 
 static int ctype (const char *name)
 {
 
 static int ctype (const char *name)
 {
-  if (0 == strcmp (name, "alnum"))
+  if (0 == mutt_strcmp (name, "alnum"))
     return MUTT_ALNUM;
     return MUTT_ALNUM;
-  if (0 == strcmp (name, "alpha"))
+  if (0 == mutt_strcmp (name, "alpha"))
     return MUTT_ALPHA;
     return MUTT_ALPHA;
-  if (0 == strcmp (name, "blank"))
+  if (0 == mutt_strcmp (name, "blank"))
     return MUTT_BLANK;
     return MUTT_BLANK;
-  if (0 == strcmp (name, "cntrl"))
+  if (0 == mutt_strcmp (name, "cntrl"))
     return MUTT_CNTRL;
     return MUTT_CNTRL;
-  if (0 == strcmp (name, "digit"))
+  if (0 == mutt_strcmp (name, "digit"))
     return MUTT_DIGIT;
     return MUTT_DIGIT;
-  if (0 == strcmp (name, "graph"))
+  if (0 == mutt_strcmp (name, "graph"))
     return MUTT_GRAPH;
     return MUTT_GRAPH;
-  if (0 == strcmp (name, "lower"))
+  if (0 == mutt_strcmp (name, "lower"))
     return MUTT_LOWER;
     return MUTT_LOWER;
-  if (0 == strcmp (name, "print"))
+  if (0 == mutt_strcmp (name, "print"))
     return MUTT_PRINT;
     return MUTT_PRINT;
-  if (0 == strcmp (name, "punct"))
+  if (0 == mutt_strcmp (name, "punct"))
     return MUTT_PUNCT;
     return MUTT_PUNCT;
-  if (0 == strcmp (name, "space"))
+  if (0 == mutt_strcmp (name, "space"))
     return MUTT_SPACE;
     return MUTT_SPACE;
-  if (0 == strcmp (name, "upper"))
+  if (0 == mutt_strcmp (name, "upper"))
     return MUTT_UPPER;
     return MUTT_UPPER;
-  if (0 == strcmp (name, "xdigit"))
+  if (0 == mutt_strcmp (name, "xdigit"))
     return MUTT_XDIGIT;
   return MUTT_INVALID;
 }
     return MUTT_XDIGIT;
   return MUTT_INVALID;
 }
@@ -396,7 +397,7 @@ char *alloca ();
 
 #define BYTEWIDTH 8             /* In bits.  */
 
 
 #define BYTEWIDTH 8             /* In bits.  */
 
-#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
+#define STREQ(s1, s2) ((mutt_strcmp (s1, s2) == 0))
 
 #undef MAX
 #undef MIN
 
 #undef MAX
 #undef MIN
index 15da1f1..0fcc857 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -24,6 +24,7 @@
 #include "mutt.h"
 #include "mime.h"
 #include "charset.h"
 #include "mutt.h"
 #include "mime.h"
 #include "charset.h"
+#include "lib/str.h"
 #include "rfc2047.h"
 #include "rfc2231.h"
 
 #include "rfc2047.h"
 #include "rfc2231.h"
 
@@ -229,7 +230,7 @@ static void rfc2231_list_insert (struct rfc2231_parameter **list,
     q = p;
     p = p->next;
 
     q = p;
     p = p->next;
 
-    c = strcmp (par->value, q->value);
+    c = mutt_strcmp (par->value, q->value);
     if ((c > 0) || (c == 0 && par->index >= q->index))
       break;
   }
     if ((c > 0) || (c == 0 && par->index >= q->index))
       break;
   }
@@ -278,7 +279,7 @@ static void rfc2231_join_continuations (PARAMETER ** head,
       rfc2231_free_parameter (&par);
       if ((par = q))
         valp = par->value;
       rfc2231_free_parameter (&par);
       if ((par = q))
         valp = par->value;
-    } while (par && !strcmp (par->attribute, attribute));
+    } while (par && !mutt_strcmp (par->attribute, attribute));
 
     if (value) {
       if (encoded)
 
     if (value) {
       if (encoded)
index fe7ba89..c352913 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -117,7 +117,7 @@ char *make_sidebar_entry (char *box, int size, int new, int flagged)
 #if USE_IMAP
   if (ImapHomeNamespace && mutt_strlen (ImapHomeNamespace) > 0) {
     if (strncmp (box, ImapHomeNamespace, mutt_strlen (ImapHomeNamespace)) == 0
 #if USE_IMAP
   if (ImapHomeNamespace && mutt_strlen (ImapHomeNamespace) > 0) {
     if (strncmp (box, ImapHomeNamespace, mutt_strlen (ImapHomeNamespace)) == 0
-        && strcmp (box, ImapHomeNamespace) != 0) {
+        && mutt_strcmp (box, ImapHomeNamespace) != 0) {
       box += mutt_strlen (ImapHomeNamespace) + 1;
     }
   }
       box += mutt_strlen (ImapHomeNamespace) + 1;
     }
   }
@@ -311,7 +311,7 @@ int sidebar_draw (int menu)
       }
     }
     else {
       }
     }
     else {
-      if (Context && !strcmp (tmp->path, Context->path)) {
+      if (Context && !mutt_strcmp (tmp->path, Context->path)) {
         printw ("%.*s", SidebarWidth - delim_len,
                 make_sidebar_entry (basename (tmp->path),
                                     Context->msgcount, Context->unread,
         printw ("%.*s", SidebarWidth - delim_len,
                 make_sidebar_entry (basename (tmp->path),
                                     Context->msgcount, Context->unread,
index 0eac092..43366b4 100644 (file)
@@ -47,8 +47,9 @@
 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
 
 #include <string.h>
 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
 
 #include <string.h>
-# include <ctype.h>
+#include <ctype.h>
 #include <sys/types.h>
 #include <sys/types.h>
+#include "lib/str.h"
 
 /* Define this as a fall through, HAVE_STDARG_H is probably already set */
 
 
 /* Define this as a fall through, HAVE_STDARG_H is probably already set */
 
@@ -766,7 +767,7 @@ int main (void)
     for (y = 0; fp_nums[y] != 0; y++) {
       snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]);
       sprintf (buf2, fp_fmt[x], fp_nums[y]);
     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 (strcmp (buf1, buf2)) {
+      if (mutt_strcmp (buf1, buf2)) {
         printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
                 fp_fmt[x], buf1, buf2);
         fail++;
         printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
                 fp_fmt[x], buf1, buf2);
         fail++;
@@ -778,7 +779,7 @@ int main (void)
     for (y = 0; int_nums[y] != 0; y++) {
       snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]);
       sprintf (buf2, int_fmt[x], int_nums[y]);
     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 (strcmp (buf1, buf2)) {
+      if (mutt_strcmp (buf1, buf2)) {
         printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf  = %s\n",        /* __SPRINTF_CHECKED__ */
                 int_fmt[x], buf1, buf2);
         fail++;
         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 60296c3..847eb25 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -12,6 +12,7 @@
 #endif
 
 #include "mutt.h"
 #endif
 
 #include "mutt.h"
+#include "lib/str.h"
 #include "sort.h"
 #include "mutt_idna.h"
 
 #include "sort.h"
 #include "mutt_idna.h"
 
@@ -212,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))
   /* 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 (strcmp (aptr, bptr)));
+    return (SORTCODE (mutt_strcmp (aptr, bptr)));
 
   /* Otherwise, we have numeric value for both attrs. If these values */
   /* are equal, then we first fall back upon string comparison, then  */
   /* upon auxiliary sort.                                             */
   if (result == 0) {
 
   /* 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 = strcmp (aptr, bptr);
+    result = mutt_strcmp (aptr, bptr);
     if (result == 0)
       AUXSORT (result, a, b);
   }
     if (result == 0)
       AUXSORT (result, a, b);
   }