projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
drop mem_alloc and mem_free, use my own hand crafted optmized macros that
[apps/madmutt.git]
/
mx.c
diff --git
a/mx.c
b/mx.c
index
0d2ec9c
..
e173aad
100644
(file)
--- a/
mx.c
+++ b/
mx.c
@@
-12,6
+12,8
@@
# include "config.h"
#endif
# include "config.h"
#endif
+#include <lib-lib/mem.h>
+
#include "mutt.h"
#include "buffy.h"
#include "ascii.h"
#include "mutt.h"
#include "buffy.h"
#include "ascii.h"
@@
-291,7
+293,7
@@
int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
int mx_unlock_file (const char *path, int fd, int dot)
{
#ifdef USE_FCNTL
int mx_unlock_file (const char *path, int fd, int dot)
{
#ifdef USE_FCNTL
- struct flock unlockit
= { F_UNLCK, 0, 0, 0 }
;
+ struct flock unlockit;
memset (&unlockit, 0, sizeof (struct flock));
unlockit.l_type = F_UNLCK;
memset (&unlockit, 0, sizeof (struct flock));
unlockit.l_type = F_UNLCK;
@@
-518,8
+520,8
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
int rc;
if (!ctx)
int rc;
if (!ctx)
- ctx =
mem_malloc (sizeof (CONTEXT)
);
-
memset (ctx, 0, sizeof (CONTEXT)
);
+ ctx =
p_new(CONTEXT, 1
);
+
p_clear(ctx, 1
);
ctx->path = str_dup (path);
ctx->msgnotreadyet = -1;
ctx->path = str_dup (path);
ctx->msgnotreadyet = -1;
@@
-536,7
+538,7
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
if (mx_open_mailbox_append (ctx, flags) != 0) {
mx_fastclose_mailbox (ctx);
if (!pctx)
if (mx_open_mailbox_append (ctx, flags) != 0) {
mx_fastclose_mailbox (ctx);
if (!pctx)
-
mem_free
(&ctx);
+
p_delete
(&ctx);
return NULL;
}
return ctx;
return NULL;
}
return ctx;
@@
-559,7
+561,7
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
if (ctx->magic <= 0) {
mx_fastclose_mailbox (ctx);
if (!pctx)
if (ctx->magic <= 0) {
mx_fastclose_mailbox (ctx);
if (!pctx)
-
mem_free
(&ctx);
+
p_delete
(&ctx);
return (NULL);
}
return (NULL);
}
@@
-589,7
+591,7
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
else {
mx_fastclose_mailbox (ctx);
if (!pctx)
else {
mx_fastclose_mailbox (ctx);
if (!pctx)
-
mem_free
(&ctx);
+
p_delete
(&ctx);
}
unset_option (OPTFORCEREFRESH);
}
unset_option (OPTFORCEREFRESH);
@@
-613,14
+615,14
@@
void mx_fastclose_mailbox (CONTEXT * ctx)
mutt_clear_threads (ctx);
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header (&ctx->hdrs[i]);
mutt_clear_threads (ctx);
for (i = 0; i < ctx->msgcount; i++)
mutt_free_header (&ctx->hdrs[i]);
-
mem_free
(&ctx->hdrs);
-
mem_free
(&ctx->v2r);
+
p_delete
(&ctx->hdrs);
+
p_delete
(&ctx->v2r);
#ifdef USE_COMPRESSED
if (ctx->compressinfo)
mutt_fast_close_compressed (ctx);
#endif
#ifdef USE_COMPRESSED
if (ctx->compressinfo)
mutt_fast_close_compressed (ctx);
#endif
-
mem_free
(&ctx->path);
-
mem_free
(&ctx->pattern);
+
p_delete
(&ctx->path);
+
p_delete
(&ctx->pattern);
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
if (ctx->limit_pattern)
mutt_pattern_free (&ctx->limit_pattern);
safe_fclose (&ctx->fp);
@@
-1161,7
+1163,7
@@
MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
}
}
else
}
}
else
-
mem_free
(&msg);
+
p_delete
(&msg);
return msg;
}
return msg;
}
@@
-1212,7
+1214,7
@@
MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
if (msg->fp == NULL) {
mutt_perror (path);
debug_print (1, ("fopen: %s: %s (errno %d).\n", path, strerror (errno), errno));
if (msg->fp == NULL) {
mutt_perror (path);
debug_print (1, ("fopen: %s: %s (errno %d).\n", path, strerror (errno), errno));
-
mem_free
(&msg);
+
p_delete
(&msg);
}
}
break;
}
}
break;
@@
-1221,7
+1223,7
@@
MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
case M_IMAP:
{
if (imap_fetch_message (msg, ctx, msgno) != 0)
case M_IMAP:
{
if (imap_fetch_message (msg, ctx, msgno) != 0)
-
mem_free
(&msg);
+
p_delete
(&msg);
break;
}
#endif /* USE_IMAP */
break;
}
#endif /* USE_IMAP */
@@
-1230,7
+1232,7
@@
MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
case M_POP:
{
if (pop_fetch_message (msg, ctx, msgno) != 0)
case M_POP:
{
if (pop_fetch_message (msg, ctx, msgno) != 0)
-
mem_free
(&msg);
+
p_delete
(&msg);
break;
}
#endif /* USE_POP */
break;
}
#endif /* USE_POP */
@@
-1239,14
+1241,14
@@
MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
case M_NNTP:
{
if (nntp_fetch_message (msg, ctx, msgno) != 0)
case M_NNTP:
{
if (nntp_fetch_message (msg, ctx, msgno) != 0)
-
mem_free
(&msg);
+
p_delete
(&msg);
break;
}
#endif /* USE_NNTP */
default:
debug_print (1, ("function not implemented for mailbox type %d.\n", ctx->magic));
break;
}
#endif /* USE_NNTP */
default:
debug_print (1, ("function not implemented for mailbox type %d.\n", ctx->magic));
-
mem_free
(&msg);
+
p_delete
(&msg);
break;
}
return (msg);
break;
}
return (msg);
@@
-1288,10
+1290,10
@@
int mx_close_message (MESSAGE ** msg)
if ((*msg)->path) {
debug_print (1, ("unlinking %s\n", (*msg)->path));
unlink ((*msg)->path);
if ((*msg)->path) {
debug_print (1, ("unlinking %s\n", (*msg)->path));
unlink ((*msg)->path);
-
mem_free
(&(*msg)->path);
+
p_delete
(&(*msg)->path);
}
}
-
mem_free
(msg);
+
p_delete
(msg);
return (r);
}
return (r);
}
@@
-1353,7
+1355,7
@@
void mx_update_context (CONTEXT * ctx, int new_messages)
h2 = hash_find (ctx->id_hash, h->env->supersedes);
h2 = hash_find (ctx->id_hash, h->env->supersedes);
- /*
mem_free
(&h->env->supersedes); should I ? */
+ /*
p_delete
(&h->env->supersedes); should I ? */
if (h2) {
h2->superseded = 1;
if (!ctx->counting && option (OPTSCORE))
if (h2) {
h2->superseded = 1;
if (!ctx->counting && option (OPTSCORE))