#endif
#include "mutt.h"
+#include "ascii.h"
#include "mx.h"
#include "mbox.h"
#include "mh.h"
#include "rfc2047.h"
#include "sort.h"
+#include "thread.h"
#include "copy.h"
#include "keymap.h"
#include "url.h"
int rc;
if (!ctx)
- ctx = safe_malloc (sizeof (CONTEXT));
+ ctx = mem_malloc (sizeof (CONTEXT));
memset (ctx, 0, sizeof (CONTEXT));
ctx->path = str_dup (path);
if (mx_open_mailbox_append (ctx, flags) != 0) {
mx_fastclose_mailbox (ctx);
if (!pctx)
- FREE (&ctx);
+ mem_free (&ctx);
return NULL;
}
return ctx;
if (ctx->magic <= 0) {
mx_fastclose_mailbox (ctx);
if (!pctx)
- FREE (&ctx);
+ mem_free (&ctx);
return (NULL);
}
else {
mx_fastclose_mailbox (ctx);
if (!pctx)
- FREE (&ctx);
+ mem_free (&ctx);
}
unset_option (OPTFORCEREFRESH);
mutt_clear_threads (ctx);
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header (&ctx->hdrs[i]);
- FREE (&ctx->hdrs);
- FREE (&ctx->v2r);
+ mem_free (&ctx->hdrs);
+ mem_free (&ctx->v2r);
#ifdef USE_COMPRESSED
if (ctx->compressinfo)
mutt_fast_close_compressed (ctx);
#endif
- FREE (&ctx->path);
- FREE (&ctx->pattern);
+ mem_free (&ctx->path);
+ mem_free (&ctx->pattern);
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
return (NULL);
}
- msg = safe_calloc (1, sizeof (MESSAGE));
+ msg = mem_calloc (1, sizeof (MESSAGE));
msg->magic = dest->magic;
msg->write = 1;
}
}
else
- FREE (&msg);
+ mem_free (&msg);
return msg;
}
{
MESSAGE *msg;
- msg = safe_calloc (1, sizeof (MESSAGE));
+ msg = mem_calloc (1, sizeof (MESSAGE));
switch (msg->magic = ctx->magic) {
case M_MBOX:
case M_MMDF:
if (msg->fp == NULL) {
mutt_perror (path);
debug_print (1, ("fopen: %s: %s (errno %d).\n", path, strerror (errno), errno));
- FREE (&msg);
+ mem_free (&msg);
}
}
break;
case M_IMAP:
{
if (imap_fetch_message (msg, ctx, msgno) != 0)
- FREE (&msg);
+ mem_free (&msg);
break;
}
#endif /* USE_IMAP */
case M_POP:
{
if (pop_fetch_message (msg, ctx, msgno) != 0)
- FREE (&msg);
+ mem_free (&msg);
break;
}
#endif /* USE_POP */
case M_NNTP:
{
if (nntp_fetch_message (msg, ctx, msgno) != 0)
- FREE (&msg);
+ mem_free (&msg);
break;
}
#endif /* USE_NNTP */
default:
debug_print (1, ("function not implemented for mailbox type %d.\n", ctx->magic));
- FREE (&msg);
+ mem_free (&msg);
break;
}
return (msg);
if ((*msg)->path) {
debug_print (1, ("unlinking %s\n", (*msg)->path));
unlink ((*msg)->path);
- FREE (&(*msg)->path);
+ mem_free (&(*msg)->path);
}
- FREE (msg);
+ mem_free (msg);
return (r);
}
}
if (ctx->hdrs) {
- safe_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25));
- safe_realloc (&ctx->v2r, sizeof (int) * ctx->hdrmax);
+ mem_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25));
+ mem_realloc (&ctx->v2r, sizeof (int) * ctx->hdrmax);
}
else {
- ctx->hdrs = safe_calloc ((ctx->hdrmax += 25), sizeof (HEADER *));
- ctx->v2r = safe_calloc (ctx->hdrmax, sizeof (int));
+ ctx->hdrs = mem_calloc ((ctx->hdrmax += 25), sizeof (HEADER *));
+ ctx->v2r = mem_calloc (ctx->hdrmax, sizeof (int));
}
for (i = ctx->msgcount; i < ctx->hdrmax; i++) {
ctx->hdrs[i] = NULL;
h2 = hash_find (ctx->id_hash, h->env->supersedes);
- /* FREE (&h->env->supersedes); should I ? */
+ /* mem_free (&h->env->supersedes); should I ? */
if (h2) {
h2->superseded = 1;
if (!ctx->counting && option (OPTSCORE))