use more ad-hoc list handling function, and avoid to muck with ->next
[apps/madmutt.git] / lib-mime / rfc2231.c
index ff6a02c..b5a2553 100644 (file)
@@ -47,6 +47,7 @@
 #include <lib-mime/mime.h>
 
 #include "charset.h"
+#include "mutt.h"
 
 typedef struct rfc2231_param {
     struct rfc2231_param *next;
@@ -139,8 +140,7 @@ static void purge_empty_parameters(PARAMETER **headp)
         PARAMETER *p = *headp;
 
         if (!p->attribute || !p->value) {
-            *headp = p->next;
-            p->next = NULL;
+            p = parameter_list_pop(headp);
             parameter_delete(&p);
         } else {
             headp = &(*headp)->next;
@@ -242,8 +242,8 @@ void rfc2231_decode_parameters (PARAMETER ** headp)
             if (option (OPTRFC2047PARAMS) && p->value && strstr (p->value, "=?"))
                 rfc2047_decode (&p->value);
             else if (!option (OPTSTRICTMIME)) {
-                if (ascii_strcasecmp (AssumedCharset, "us-ascii"))
-                    mutt_convert_nonmime_string (&p->value);
+                if (mime_which_token(AssumedCharset, -1) == MIME_US_ASCII)
+                    mutt_convert_nonmime_string(&p->value);
             }
 
             *last = p;