]> diplodocus.org Git - nmh/commitdiff
Use HasPrefix() instead of strncmp().
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 23 Oct 2016 21:48:49 +0000 (22:48 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 24 Oct 2016 09:18:56 +0000 (10:18 +0100)
sbr/mf.c

index ebd130d..870a0a5 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 ");
 }