]> diplodocus.org Git - nmh/blobdiff - uip/mhfixmsg.c
Remove unused NCWD and NPWD #defines.
[nmh] / uip / mhfixmsg.c
index e5a9f459aba56968e6b21073927229202960f648..0c5c2cef8700e8a4463a8ab0749d8254ac17d157 100644 (file)
@@ -819,9 +819,7 @@ replace_boundary (CT ct, char *file, char *boundary) {
                 fprintf (fpout, "%s:%s%s\n", np, new_ctline,
                         new_params ? new_params : "");
                free(new_ctline);
-               if (new_params) {
-                   free(new_params);
-                }
+                mh_xfree(new_params);
             }
 
             free (vp);
@@ -1002,9 +1000,9 @@ replace_substring (char **str, const char *old, const char *new) {
         free (*str);
 
         return *str = new_str;
-    } else {
-        return NULL;
     }
+
+    return NULL;
 }
 
 
@@ -1180,9 +1178,9 @@ set_ce (CT ct, int encoding) {
         ct->c_celine = add (cte, NULL);
 
         return OK;
-    } else {
-        return NOTOK;
     }
+
+    return NOTOK;
 }
 
 
@@ -1410,12 +1408,12 @@ insert_new_text_plain_part (CT ct, int new_subpart_number, CT parent) {
                     buffer, NULL);
 
         return 1;
-    } else {
-        free_content (new_part->mp_part);
-        free (new_part);
-
-        return 0;
     }
+
+    free_content (new_part->mp_part);
+    free (new_part);
+
+    return 0;
 }
 
 
@@ -1601,14 +1599,13 @@ reformat_part (CT ct, char *file, char *type, char *subtype, int c_type) {
                     ct->c_file, invo_name, type, subtype);
         }
         return NOTOK;
-    } else {
-        if (strchr (cf, '>')) {
-            advise (NULL, "'>' prohibited in \"%s\",\nplease fix your "
-                    "%s-format-%s/%s profile entry", cf, invo_name, type,
-                    subtype ? subtype : "");
+    }
+    if (strchr (cf, '>')) {
+        advise (NULL, "'>' prohibited in \"%s\",\nplease fix your "
+                "%s-format-%s/%s profile entry", cf, invo_name, type,
+                subtype ? subtype : "");
 
-            return NOTOK;
-        }
+        return NOTOK;
     }
 
     cp = concat (cf, " >", file, NULL);
@@ -2247,12 +2244,10 @@ strip_crs (CT ct, int *message_mods) {
                     status = NOTOK;
                 } else {
                     /* Replace the decoded file with the converted one. */
-                    if (ct->c_cefile.ce_file) {
-                        if (ct->c_cefile.ce_unlink) {
-                            (void) m_unlink (ct->c_cefile.ce_file);
-                        }
-                        free (ct->c_cefile.ce_file);
-                    }
+                    if (ct->c_cefile.ce_file && ct->c_cefile.ce_unlink)
+                        (void) m_unlink (ct->c_cefile.ce_file);
+
+                    mh_xfree(ct->c_cefile.ce_file);
                     ct->c_cefile.ce_file = stripped_content_file;
                     ct->c_cefile.ce_unlink = 1;
 
@@ -2531,7 +2526,7 @@ fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) {
     int fixed = 0;
 
     if (((value_len = strlen (value)) > 0)  &&
-        strncmp (value, "=?", 2) == 0  &&
+        HasPrefix(value, "=?") &&
         strncmp (&value[value_len - 2], "?=", 2) == 0) {
         /* Looks like an RFC 2047 encoded parameter. */
         char decoded[PATH_MAX + 1];
@@ -2603,8 +2598,8 @@ fix_filename_encoding (CT ct) {
                 const char *const new_params = concat (params, "\n", NULL);
 
                 replace_substring (&hf->value, semicolon_loc, new_params);
-                free ((char *) new_params);
-                free ((char *) params);
+                free((void *)new_params); /* Cast away const.  Sigh. */
+                free((void *)params);
             } else {
                 advise (NULL, "did not find semicolon in %s:%s\n",
                         hf->name, hf->value);
@@ -2741,12 +2736,11 @@ remove_file (const char *file) {
 
         free (rmm_command);
         return WIFEXITED (status)  ?  WEXITSTATUS (status)  :  NOTOK;
-    } else {
-        /* This is OK for a non-message file, it still uses the
-           BACKUP_PREFIX form.  The backup file will be in the same
-           directory as file. */
-        return rename (file, m_backup (file));
     }
+    /* This is OK for a non-message file, it still uses the
+       BACKUP_PREFIX form.  The backup file will be in the same
+       directory as file. */
+    return rename (file, m_backup (file));
 }