simplifications
authorPierre Habouzit <madcoder@debian.org>
Tue, 7 Nov 2006 22:34:46 +0000 (23:34 +0100)
committerPierre Habouzit <madcoder@debian.org>
Tue, 7 Nov 2006 22:34:46 +0000 (23:34 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
lib-mime/rfc822parse.c

index 5509b8c..70f405e 100644 (file)
@@ -1176,34 +1176,25 @@ mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed)
     return e;
 }
 
-/* -------------------- XXX: MC READ MARK ------------- */
-
 /* Compares mime types to the ok and except lists */
-static int count_body_parts_check(LIST **checklist, BODY *b, int dflt)
+static int count_body_parts_check(LIST **checklist, BODY *b)
 {
     LIST *type;
-    ATTACH_MATCH *a;
-
-    /* If list is null, use default behavior. */
-    if (!*checklist)
-        return 0;
 
     for (type = *checklist; type; type = type->next) {
-        a = (ATTACH_MATCH *)type->data;
-        debug_print(5, ("cbpc: %s %d/%s ?? %s/%s [%d]... ",
-                        dflt ? "[OK] " : "[EXCL] ",
-                        b->type, b->subtype, a->major, a->minor, a->major_int));
-        if ((a->major_int == TYPEANY || a->major_int == b->type) &&
-            !regexec(&a->minor_rx, b->subtype, 0, NULL, 0)) {
-            debug_print(5, ("yes\n"));
+        ATTACH_MATCH *a = (ATTACH_MATCH *)type->data;
+
+        if ((a->major_int == TYPEANY || a->major_int == b->type)
+        &&  !regexec(&a->minor_rx, b->subtype, 0, NULL, 0)) {
             return 1;
-        } else {
-            debug_print(5, ("no\n"));
         }
     }
+
     return 0;
 }
 
+/* -------------------- XXX: MC READ MARK ------------- */
+
 #define AT_COUNT(why) { shallcount = 1; }
 #define AT_NOCOUNT(why) { shallcount = 0; }
 
@@ -1261,14 +1252,14 @@ int count_body_parts (BODY *body, int flags) {
        */
 
       if (bp->disposition == DISPATTACH) {
-        if (!count_body_parts_check(&AttachAllow, bp, 1))
+        if (!count_body_parts_check(&AttachAllow, bp))
           AT_NOCOUNT("attach not allowed");
-        if (count_body_parts_check(&AttachExclude, bp, 0))
+        if (count_body_parts_check(&AttachExclude, bp))
           AT_NOCOUNT("attach excluded");
       } else {
-        if (!count_body_parts_check(&InlineAllow, bp, 1))
+        if (!count_body_parts_check(&InlineAllow, bp))
           AT_NOCOUNT("inline not allowed");
-        if (count_body_parts_check(&InlineExclude, bp, 0))
+        if (count_body_parts_check(&InlineExclude, bp))
           AT_NOCOUNT("excluded");
       }
     }