X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=rfc2231.c;h=aa6b071c60dbafc5cb99c9b1e196b44aedd17ba3;hp=f7caea15a45166f9e9cb01eb033bbf69238c9266;hb=c22c84b23ab59c81ccd397c992b1c4adbbddeb80;hpb=a8477ebaa09990b3688164cbe5cf661c4189541d diff --git a/rfc2231.c b/rfc2231.c index f7caea1..aa6b071 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -21,15 +21,16 @@ # include "config.h" #endif +#include +#include +#include + #include "mutt.h" #include "mime.h" #include "charset.h" -#include "lib/str.h" #include "rfc2047.h" #include "rfc2231.h" -#include "lib/mem.h" - #include #include #include @@ -145,7 +146,7 @@ void rfc2231_decode_parameters (PARAMETER ** headp) p->attribute = NULL; p->value = NULL; - FREE (&p); + p_delete(&p); rfc2231_list_insert (&conthead, conttmp); } @@ -164,15 +165,15 @@ void rfc2231_decode_parameters (PARAMETER ** headp) 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); } } @@ -269,9 +270,9 @@ static void rfc2231_join_continuations (PARAMETER ** head, if (encoded && par->encoded) rfc2231_decode_one (par->value, valp); - vl = str_len (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; @@ -285,7 +286,7 @@ static void rfc2231_join_continuations (PARAMETER ** head, if (encoded) mutt_convert_string (&value, charset, Charset, M_ICONV_HOOK_FROM); *head = mutt_new_parameter (); - (*head)->attribute = str_dup (attribute); + (*head)->attribute = m_strdup(attribute); (*head)->value = value; head = &(*head)->next; } @@ -314,10 +315,10 @@ int rfc2231_encode_string (char **pd) if (!Charset || !SendCharset || !(charset = mutt_choose_charset (Charset, SendCharset, - *pd, str_len (*pd), &d, &dlen))) { - charset = str_dup (Charset ? Charset : "unknown-8bit"); + *pd, m_strlen(*pd), &d, &dlen))) { + charset = m_strdup(Charset ? Charset : "unknown-8bit"); d = *pd; - dlen = str_len (d); + dlen = m_strlen(d); } if (!mutt_is_us_ascii (charset)) @@ -330,9 +331,9 @@ int rfc2231_encode_string (char **pd) ++ext; if (encode) { - e = safe_malloc (dlen + 2 * ext + str_len (charset) + 3); + e = p_new(char, dlen + 2 * ext + m_strlen(charset) + 3); sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */ - t = e + str_len (e); + t = e + m_strlen(e); for (s = d, slen = dlen; slen; s++, slen--) if (*s < 0x20 || *s >= 0x7f || strchr (MimeSpecials, *s) || strchr ("*'%", *s)) { @@ -344,16 +345,16 @@ int rfc2231_encode_string (char **pd) *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; }