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);
continue;
case BODY:
- fputs ("\n", fpout);
+ putc('\n', fpout);
/* buf will have a terminating NULL, skip it. */
if ((int) fwrite (buf, 1, bufsz-1, fpout) < bufsz-1) {
advise (file, "fwrite");
* c_ctline
*/
/* Extract type and subtype from type/subtype. */
- ct_type = getcpy (ct_type_subtype);
+ ct_type = mh_xstrdup(ct_type_subtype);
if ((cp = strchr (ct_type, '/'))) {
*cp = '\0';
- ct_subtype = getcpy (++cp);
+ ct_subtype = mh_xstrdup(++cp);
} else {
advise (NULL, "missing / in MIME type of %s %s",
ct->c_file, ct->c_partno);
char *prefix, *new_str;
if (cp - *str) {
- prefix = getcpy (*str);
+ prefix = mh_xstrdup(*str);
*(prefix + (cp - *str)) = '\0';
new_str = concat (prefix, new, remainder, NULL);
free (prefix);
free (*str);
return *str = new_str;
- } else {
- return NULL;
}
+
+ return NULL;
}
ct->c_celine = add (cte, NULL);
return OK;
- } else {
- return NOTOK;
}
+
+ return NOTOK;
}
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;
}
d_pm = add_param(&dest->ci_first_pm, &dest->ci_last_pm, s_pm->pm_name,
s_pm->pm_value, 0);
if (s_pm->pm_charset) {
- d_pm->pm_charset = getcpy(s_pm->pm_charset);
+ d_pm->pm_charset = mh_xstrdup(s_pm->pm_charset);
}
if (s_pm->pm_lang) {
- d_pm->pm_lang = getcpy(s_pm->pm_lang);
+ d_pm->pm_lang = mh_xstrdup(s_pm->pm_lang);
}
}
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);
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;
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];
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);
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));
}