# include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
+#include <lib-lib/ascii.h>
+
#include "mutt.h"
#include "mime.h"
#include "charset.h"
-#include "lib/str.h"
#include "rfc2047.h"
#include "rfc2231.h"
-#include "lib/mem.h"
-
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
p->attribute = NULL;
p->value = NULL;
- FREE (&p);
+ p_delete(&p);
rfc2231_list_insert (&conthead, conttmp);
}
static struct rfc2231_parameter *rfc2231_new_parameter (void)
{
- return safe_calloc (sizeof (struct rfc2231_parameter), 1);
+ return p_new(struct rfc2231_parameter, 1);
}
static void rfc2231_free_parameter (struct rfc2231_parameter **p)
{
if (*p) {
- FREE (&(*p)->attribute);
- FREE (&(*p)->value);
- FREE (p);
+ p_delete(&(*p)->attribute);
+ p_delete(&(*p)->value);
+ p_delete(p);
}
}
q = p;
p = p->next;
- c = safe_strcmp (par->value, q->value);
+ c = str_cmp (par->value, q->value);
if ((c > 0) || (c == 0 && par->index >= q->index))
break;
}
if (encoded && par->encoded)
rfc2231_decode_one (par->value, valp);
- vl = safe_strlen (par->value);
+ vl = m_strlen(par->value);
- safe_realloc (&value, l + vl + 1);
+ p_realloc(&value, l + vl + 1);
strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */
l += vl;
rfc2231_free_parameter (&par);
if ((par = q))
valp = par->value;
- } while (par && !safe_strcmp (par->attribute, attribute));
+ } while (par && !str_cmp (par->attribute, attribute));
if (value) {
if (encoded)
mutt_convert_string (&value, charset, Charset, M_ICONV_HOOK_FROM);
*head = mutt_new_parameter ();
- (*head)->attribute = safe_strdup (attribute);
+ (*head)->attribute = m_strdup(attribute);
(*head)->value = value;
head = &(*head)->next;
}
if (!Charset || !SendCharset ||
!(charset = mutt_choose_charset (Charset, SendCharset,
- *pd, safe_strlen (*pd), &d, &dlen))) {
- charset = safe_strdup (Charset ? Charset : "unknown-8bit");
+ *pd, m_strlen(*pd), &d, &dlen))) {
+ charset = m_strdup(Charset ? Charset : "unknown-8bit");
d = *pd;
- dlen = safe_strlen (d);
+ dlen = m_strlen(d);
}
if (!mutt_is_us_ascii (charset))
++ext;
if (encode) {
- e = safe_malloc (dlen + 2 * ext + safe_strlen (charset) + 3);
+ e = p_new(char, dlen + 2 * ext + m_strlen(charset) + 3);
sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */
- t = e + safe_strlen (e);
+ t = e + m_strlen(e);
for (s = d, slen = dlen; slen; s++, slen--)
if (*s < 0x20 || *s >= 0x7f ||
strchr (MimeSpecials, *s) || strchr ("*'%", *s)) {
*t = '\0';
if (d != *pd)
- FREE (&d);
- FREE (pd);
+ p_delete(&d);
+ p_delete(pd);
*pd = e;
}
else if (d != *pd) {
- FREE (pd);
+ p_delete(pd);
*pd = d;
}
- FREE (&charset);
+ p_delete(&charset);
return encode;
}