]> diplodocus.org Git - nmh/blobdiff - sbr/mf.c
Just show relevant portion of invalid encoded string.
[nmh] / sbr / mf.c
index 63b13ba411f8e9bc1d033984f7730c0c755c9d09..870a0a5215d2907702bea14139e67e75214fa434 100644 (file)
--- a/sbr/mf.c
+++ b/sbr/mf.c
@@ -26,8 +26,8 @@ static int my_lex (char *);
 int
 isfrom(const char *string)
 {
-    return (strncmp (string, "From ", 5) == 0
-           || strncmp (string, ">From ", 6) == 0);
+    return (HasPrefix(string, "From ")
+           || HasPrefix(string, ">From "));
 }
 
 
@@ -52,10 +52,8 @@ lequal (const char *a, const char *b)
 static int
 isat (const char *p)
 {
-    return (strncmp (p, " AT ", 4)
-           && strncmp (p, " At ", 4)
-           && strncmp (p, " aT ", 4)
-           && strncmp (p, " at ", 4) ? FALSE : TRUE);
+    return HasPrefix(p, " AT ") || HasPrefix(p, " At ") ||
+        HasPrefix(p, " aT ") || HasPrefix(p, " at ");
 }
 
 
@@ -180,18 +178,12 @@ getadrx (const char *addrs, int eai)
     char *bp;
     struct adrx *adrxp = &adrxs2;
 
-    if (pers)
-       free (pers);
-    if (mbox)
-       free (mbox);
-    if (host)
-       free (host);
-    if (path)
-       free (path);
-    if (grp)
-       free (grp);
-    if (note)
-       free (note);
+    mh_xfree(pers);
+    mh_xfree(mbox);
+    mh_xfree(host);
+    mh_xfree(path);
+    mh_xfree(grp);
+    mh_xfree(note);
     pers = mbox = host = path = grp = note = NULL;
     err[0] = 0;
 
@@ -297,10 +289,8 @@ again: ;
                return NOTOK;
            }
        case LX_COMA: 
-           if (note) {
-               free (note);
-               note = NULL;
-           }
+            mh_xfree(note);
+            note = NULL;
            goto again;
 
        case LX_END: