projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix regression. make the hook types be ints.
[apps/madmutt.git]
/
mx.c
diff --git
a/mx.c
b/mx.c
index
0d2ec9c
..
b1efdce
100644
(file)
--- a/
mx.c
+++ b/
mx.c
@@
-12,33
+12,32
@@
# include "config.h"
#endif
# include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/ascii.h>
+#include <lib-lib/str.h>
+#include <lib-lib/macros.h>
+#include <lib-lib/file.h>
+
+#include <lib-mime/mime.h>
+
#include "mutt.h"
#include "buffy.h"
#include "mutt.h"
#include "buffy.h"
-#include "ascii.h"
#include "mx.h"
#include "mbox.h"
#include "mh.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"
#include "sidebar.h"
#include "sort.h"
#include "thread.h"
#include "copy.h"
#include "keymap.h"
#include "url.h"
#include "sidebar.h"
-
-#ifdef USE_COMPRESSED
#include "compress.h"
#include "compress.h"
-#endif
-#ifdef USE_IMAP
-#include "imap/imap.h"
-#include "imap/mx_imap.h"
-#endif
+#include <imap/imap.h>
+#include <imap/mx_imap.h>
-#ifdef USE_POP
-#include "pop/pop.h"
-#include "pop/mx_pop.h"
-#endif
+#include <pop/pop.h>
+#include <pop/mx_pop.h>
#ifdef USE_NNTP
#include "nntp/nntp.h"
#ifdef USE_NNTP
#include "nntp/nntp.h"
@@
-49,11
+48,8
@@
#include "dotlock.h"
#endif
#include "dotlock.h"
#endif
-#include
"mutt_crypt.h"
+#include
<lib-crypt/crypt.h>
-#include "lib/mem.h"
-#include "lib/intl.h"
-#include "lib/str.h"
#include "lib/list.h"
#include "lib/debug.h"
#include "lib/list.h"
#include "lib/debug.h"
@@
-72,7
+68,7
@@
static list2_t* MailboxFormats = NULL;
#define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd
#define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length)
#define MX_COMMAND(idx,cmd) ((mx_t*) MailboxFormats->data[idx])->cmd
#define MX_IDX(idx) (idx >= 0 && idx < MailboxFormats->length)
-#define mutt_is_spool(s) (
str_cmp
(Spoolfile, s) == 0)
+#define mutt_is_spool(s) (
m_strcmp
(Spoolfile, s) == 0)
#ifdef USE_DOTLOCK
/* parameters:
#ifdef USE_DOTLOCK
/* parameters:
@@
-80,8
+76,6
@@
static list2_t* MailboxFormats = NULL;
* retry - should retry if unable to lock?
*/
* retry - should retry if unable to lock?
*/
-#ifdef DL_STANDALONE
-
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
{
char cmd[LONG_STRING + _POSIX_PATH_MAX];
@@
-106,12
+100,6
@@
static int invoke_dotlock (const char *path, int dummy, int flags, int retry)
return mutt_system (cmd);
}
return mutt_system (cmd);
}
-#else
-
-#define invoke_dotlock dotlock_invoke
-
-#endif
-
static int dotlock_file (const char *path, int fd, int retry)
{
int r;
static int dotlock_file (const char *path, int fd, int retry)
{
int r;
@@
-192,7
+180,7
@@
int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout)
struct flock lck;
struct flock lck;
-
memset (&lck, 0, sizeof (struct flock)
);
+
p_clear(&lck, 1
);
lck.l_type = excl ? F_WRLCK : F_RDLCK;
lck.l_whence = SEEK_SET;
lck.l_type = excl ? F_WRLCK : F_RDLCK;
lck.l_whence = SEEK_SET;
@@
-291,9
+279,9
@@
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)
);
+
p_clear(&unlockit, 1
);
unlockit.l_type = F_UNLCK;
unlockit.l_whence = SEEK_SET;
fcntl (fd, F_SETLK, &unlockit);
unlockit.l_type = F_UNLCK;
unlockit.l_whence = SEEK_SET;
fcntl (fd, F_SETLK, &unlockit);
@@
-342,7
+330,7
@@
void mx_unlink_empty (const char *path)
int mx_get_magic (const char *path) {
int i = 0;
int mx_get_magic (const char *path) {
int i = 0;
- if (
str_len
(path) == 0)
+ if (
m_strlen
(path) == 0)
return (-1);
if ((i = mx_get_idx (path)) >= 0)
return (MX_COMMAND(i,type));
return (-1);
if ((i = mx_get_idx (path)) >= 0)
return (MX_COMMAND(i,type));
@@
-390,22
+378,16
@@
static int mx_open_mailbox_append (CONTEXT * ctx, int flags)
{
struct stat sb;
{
struct stat sb;
-#ifdef USE_COMPRESSED
/* special case for appending to compressed folders -
* even if we can not open them for reading */
if (mutt_can_append_compressed (ctx->path))
mutt_open_append_compressed (ctx);
/* special case for appending to compressed folders -
* even if we can not open them for reading */
if (mutt_can_append_compressed (ctx->path))
mutt_open_append_compressed (ctx);
-#endif
ctx->append = 1;
ctx->append = 1;
-#ifdef USE_IMAP
-
if (mx_get_magic (ctx->path) == M_IMAP)
return imap_open_mailbox_append (ctx);
if (mx_get_magic (ctx->path) == M_IMAP)
return imap_open_mailbox_append (ctx);
-#endif
-
if (stat (ctx->path, &sb) == 0) {
ctx->magic = mx_get_magic (ctx->path);
if (stat (ctx->path, &sb) == 0) {
ctx->magic = mx_get_magic (ctx->path);
@@
-518,9
+500,9
@@
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->path =
str_dup
(path);
+ ctx =
p_new(CONTEXT, 1
);
+
p_clear(ctx, 1
);
+ ctx->path =
m_strdup
(path);
ctx->msgnotreadyet = -1;
ctx->collapsed = 0;
ctx->msgnotreadyet = -1;
ctx->collapsed = 0;
@@
-536,7
+518,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;
@@
-545,10
+527,8
@@
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx)
if (!MX_IDX(ctx->magic-1))
ctx->magic = mx_get_magic (path);
if (!MX_IDX(ctx->magic-1))
ctx->magic = mx_get_magic (path);
-#ifdef USE_COMPRESSED
if (ctx->magic == M_COMPRESSED)
mutt_open_read_compressed (ctx);
if (ctx->magic == M_COMPRESSED)
mutt_open_read_compressed (ctx);
-#endif
if (ctx->magic == 0)
mutt_error (_("%s is not a mailbox."), path);
if (ctx->magic == 0)
mutt_error (_("%s is not a mailbox."), path);
@@
-559,7
+539,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
+569,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,18
+593,18
@@
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);
-#ifdef USE_COMPRESSED
+
p_delete
(&ctx->hdrs);
+
p_delete
(&ctx->v2r);
+
if (ctx->compressinfo)
mutt_fast_close_compressed (ctx);
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);
-
memset (ctx, 0, sizeof (CONTEXT)
);
+
p_clear(ctx, 1
);
}
/* save changes to disk */
}
/* save changes to disk */
@@
-639,10
+619,8
@@
static int sync_mailbox (CONTEXT * ctx, int *index_hint)
/* the 1 is only of interest for IMAP and means EXPUNGE */
rc = MX_COMMAND(ctx->magic-1,mx_sync_mailbox(ctx,1,index_hint));
/* the 1 is only of interest for IMAP and means EXPUNGE */
rc = MX_COMMAND(ctx->magic-1,mx_sync_mailbox(ctx,1,index_hint));
-#ifdef USE_COMPRESSED
if (rc == 0 && ctx->compressinfo)
return mutt_sync_compressed (ctx);
if (rc == 0 && ctx->compressinfo)
return mutt_sync_compressed (ctx);
-#endif
return rc;
}
return rc;
}
@@
-743,10
+721,10
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
isSpool = 1;
if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
isSpool = 1;
-
strfcpy (mbox, p, sizeof (mbox)
);
+
m_strcpy(mbox, sizeof(mbox), p
);
}
else {
}
else {
-
strfcpy (mbox, NONULL (Inbox), sizeof (m
box));
+
m_strcpy(mbox, sizeof(mbox), NONULL(In
box));
isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
}
mutt_expand_path (mbox, sizeof (mbox));
isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
}
mutt_expand_path (mbox, sizeof (mbox));
@@
-774,10
+752,8
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
}
}
}
}
-#ifdef USE_IMAP
/* IMAP servers manage the OLD flag themselves */
if (ctx->magic != M_IMAP)
/* IMAP servers manage the OLD flag themselves */
if (ctx->magic != M_IMAP)
-#endif
if (option (OPTMARKOLD)) {
for (i = 0; i < ctx->msgcount; i++) {
if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->old)
if (option (OPTMARKOLD)) {
for (i = 0; i < ctx->msgcount; i++) {
if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->old)
@@
-788,7
+764,6
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
if (move_messages) {
mutt_message (_("Moving read messages to %s..."), mbox);
if (move_messages) {
mutt_message (_("Moving read messages to %s..."), mbox);
-#ifdef USE_IMAP
/* try to use server-side copy first */
i = 1;
/* try to use server-side copy first */
i = 1;
@@
-811,7
+786,6
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
return -1;
}
else /* use regular append-copy mode */
return -1;
}
else /* use regular append-copy mode */
-#endif
{
if (mx_open_mailbox (mbox, M_APPEND, &f) == NULL) {
ctx->closing = 0;
{
if (mx_open_mailbox (mbox, M_APPEND, &f) == NULL) {
ctx->closing = 0;
@@
-852,7
+826,6
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
return -1;
}
return -1;
}
-#ifdef USE_IMAP
/* allow IMAP to preserve the deleted flag across sessions */
if (ctx->magic == M_IMAP) {
if ((check = imap_sync_mailbox (ctx, purge, index_hint)) != 0) {
/* allow IMAP to preserve the deleted flag across sessions */
if (ctx->magic == M_IMAP) {
if ((check = imap_sync_mailbox (ctx, purge, index_hint)) != 0) {
@@
-861,7
+834,6
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
}
}
else
}
}
else
-#endif
{
if (!purge) {
for (i = 0; i < ctx->msgcount; i++)
{
if (!purge) {
for (i = 0; i < ctx->msgcount; i++)
@@
-889,10
+861,8
@@
static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint)
!mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
!mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY))
mx_unlink_empty (ctx->path);
-#ifdef USE_COMPRESSED
if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
return (-1);
if (ctx->compressinfo && mutt_slow_close_compressed (ctx))
return (-1);
-#endif
mx_fastclose_mailbox (ctx);
mx_fastclose_mailbox (ctx);
@@
-1007,8
+977,7
@@
static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
km_find_func (MENU_MAIN, OP_TOGGLE_WRITE)))
snprintf (tmp, sizeof (tmp), _(" Press '%s' to toggle write"), buf);
else
km_find_func (MENU_MAIN, OP_TOGGLE_WRITE)))
snprintf (tmp, sizeof (tmp), _(" Press '%s' to toggle write"), buf);
else
- strfcpy (tmp, _("Use 'toggle-write' to re-enable write!"),
- sizeof (tmp));
+ m_strcpy(tmp, sizeof(tmp), _("Use 'toggle-write' to re-enable write!"));
mutt_error (_("Mailbox is marked unwritable. %s"), tmp);
return -1;
mutt_error (_("Mailbox is marked unwritable. %s"), tmp);
return -1;
@@
-1036,10
+1005,8
@@
static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
else if (purge == M_NO) {
if (!ctx->changed)
return 0; /* nothing to do! */
else if (purge == M_NO) {
if (!ctx->changed)
return 0; /* nothing to do! */
-#ifdef USE_IMAP
/* let IMAP servers hold on to D flags */
if (ctx->magic != M_IMAP)
/* let IMAP servers hold on to D flags */
if (ctx->magic != M_IMAP)
-#endif
{
for (i = 0; i < ctx->msgcount; i++)
ctx->hdrs[i]->deleted = 0;
{
for (i = 0; i < ctx->msgcount; i++)
ctx->hdrs[i]->deleted = 0;
@@
-1060,19
+1027,15
@@
static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
return -1;
}
return -1;
}
-#ifdef USE_IMAP
if (ctx->magic == M_IMAP)
rc = imap_sync_mailbox (ctx, purge, index_hint);
else
if (ctx->magic == M_IMAP)
rc = imap_sync_mailbox (ctx, purge, index_hint);
else
-#endif
rc = sync_mailbox (ctx, index_hint);
if (rc == 0) {
rc = sync_mailbox (ctx, index_hint);
if (rc == 0) {
-#ifdef USE_IMAP
if (ctx->magic == M_IMAP && !purge)
mutt_message (_("Mailbox checkpointed."));
else
if (ctx->magic == M_IMAP && !purge)
mutt_message (_("Mailbox checkpointed."));
else
-#endif
mutt_message (_("%d kept, %d deleted."), msgcount - deleted, deleted);
mutt_sleep (0);
mutt_message (_("%d kept, %d deleted."), msgcount - deleted, deleted);
mutt_sleep (0);
@@
-1093,10
+1056,8
@@
static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint)
* at least with the new threading code.
*/
if (purge || (ctx->magic != M_MAILDIR && ctx->magic != M_MH)) {
* at least with the new threading code.
*/
if (purge || (ctx->magic != M_MAILDIR && ctx->magic != M_MH)) {
-#ifdef USE_IMAP
/* IMAP does this automatically after handling EXPUNGE */
if (ctx->magic != M_IMAP)
/* IMAP does this automatically after handling EXPUNGE */
if (ctx->magic != M_IMAP)
-#endif
{
mx_update_tables (ctx, 1);
mutt_sort_headers (ctx, 1); /* rethread from scratch */
{
mx_update_tables (ctx, 1);
mutt_sort_headers (ctx, 1); /* rethread from scratch */
@@
-1121,14
+1082,14
@@
int mx_sync_mailbox (CONTEXT* ctx, int* index_hint) {
MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
{
MESSAGE *msg;
MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
{
MESSAGE *msg;
-
ADDRESS
*p = NULL;
+
address_t
*p = NULL;
if (!MX_IDX(dest->magic-1)) {
debug_print (1, ("function unimplemented for mailbox type %d.\n", dest->magic));
return (NULL);
}
if (!MX_IDX(dest->magic-1)) {
debug_print (1, ("function unimplemented for mailbox type %d.\n", dest->magic));
return (NULL);
}
- msg =
mem_calloc (1, sizeof (MESSAGE)
);
+ msg =
p_new(MESSAGE, 1
);
msg->magic = dest->magic;
msg->write = 1;
msg->magic = dest->magic;
msg->write = 1;
@@
-1161,17
+1122,15
@@
MESSAGE *mx_open_new_message (CONTEXT * dest, HEADER * hdr, int flags)
}
}
else
}
}
else
-
mem_free
(&msg);
+
p_delete
(&msg);
return msg;
}
/* check for new mail */
int mx_check_mailbox (CONTEXT * ctx, int *index_hint, int lock) {
return msg;
}
/* check for new mail */
int mx_check_mailbox (CONTEXT * ctx, int *index_hint, int lock) {
-#ifdef USE_COMPRESSED
if (ctx->compressinfo)
return mutt_check_mailbox_compressed (ctx);
if (ctx->compressinfo)
return mutt_check_mailbox_compressed (ctx);
-#endif
if (ctx) {
if (ctx->locked)
if (ctx) {
if (ctx->locked)
@@
-1190,7
+1149,7
@@
MESSAGE *mx_open_message (CONTEXT * ctx, int msgno)
{
MESSAGE *msg;
{
MESSAGE *msg;
- msg =
mem_calloc (1, sizeof (MESSAGE)
);
+ msg =
p_new(MESSAGE, 1
);
switch (msg->magic = ctx->magic) {
case M_MBOX:
case M_MMDF:
switch (msg->magic = ctx->magic) {
case M_MBOX:
case M_MMDF:
@@
-1212,41
+1171,37
@@
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;
-#ifdef USE_IMAP
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;
}
break;
}
-#endif /* USE_IMAP */
-#ifdef USE_POP
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;
}
break;
}
-#endif /* USE_POP */
#ifdef USE_NNTP
case M_NNTP:
{
if (nntp_fetch_message (msg, ctx, msgno) != 0)
#ifdef USE_NNTP
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);
@@
-1270,12
+1225,8
@@
int mx_close_message (MESSAGE ** msg)
int r = 0;
if ((*msg)->magic == M_MH || (*msg)->magic == M_MAILDIR
int r = 0;
if ((*msg)->magic == M_MH || (*msg)->magic == M_MAILDIR
-#ifdef USE_IMAP
|| (*msg)->magic == M_IMAP
|| (*msg)->magic == M_IMAP
-#endif
-#ifdef USE_POP
|| (*msg)->magic == M_POP
|| (*msg)->magic == M_POP
-#endif
#ifdef USE_NNTP
|| (*msg)->magic == M_NNTP
#endif
#ifdef USE_NNTP
|| (*msg)->magic == M_NNTP
#endif
@@
-1288,10
+1239,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);
}
@@
-1308,12
+1259,12
@@
void mx_alloc_memory (CONTEXT * ctx)
}
if (ctx->hdrs) {
}
if (ctx->hdrs) {
-
mem_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25)
);
-
mem_realloc (&ctx->v2r, sizeof (int) *
ctx->hdrmax);
+
p_realloc(&ctx->hdrs, ctx->hdrmax += 25
);
+
p_realloc(&ctx->v2r,
ctx->hdrmax);
}
else {
}
else {
- ctx->hdrs =
mem_calloc ((ctx->hdrmax += 25), sizeof (HEADER *
));
- ctx->v2r =
mem_calloc (ctx->hdrmax, sizeof (int)
);
+ ctx->hdrs =
p_new(HEADER *, (ctx->hdrmax += 25
));
+ ctx->v2r =
p_new(int, ctx->hdrmax
);
}
for (i = ctx->msgcount; i < ctx->hdrmax; i++) {
ctx->hdrs[i] = NULL;
}
for (i = ctx->msgcount; i < ctx->hdrmax; i++) {
ctx->hdrs[i] = NULL;
@@
-1332,10
+1283,8
@@
void mx_update_context (CONTEXT * ctx, int new_messages)
for (msgno = ctx->msgcount - new_messages; msgno < ctx->msgcount; msgno++) {
h = ctx->hdrs[msgno];
for (msgno = ctx->msgcount - new_messages; msgno < ctx->msgcount; msgno++) {
h = ctx->hdrs[msgno];
- if (WithCrypto) {
- /* NOTE: this _must_ be done before the check for mailcap! */
- h->security = crypt_query (h->content);
- }
+ /* NOTE: this _must_ be done before the check for mailcap! */
+ h->security = crypt_query (h->content);
if (!ctx->pattern) {
ctx->v2r[ctx->vcount] = msgno;
if (!ctx->pattern) {
ctx->v2r[ctx->vcount] = msgno;
@@
-1353,7
+1302,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))
@@
-1420,18
+1369,12
@@
void mx_init (void) {
list_push_back (&MailboxFormats, (void*) mmdf_reg_mx ());
list_push_back (&MailboxFormats, (void*) mh_reg_mx ());
list_push_back (&MailboxFormats, (void*) maildir_reg_mx ());
list_push_back (&MailboxFormats, (void*) mmdf_reg_mx ());
list_push_back (&MailboxFormats, (void*) mh_reg_mx ());
list_push_back (&MailboxFormats, (void*) maildir_reg_mx ());
-#ifdef USE_IMAP
list_push_back (&MailboxFormats, (void*) imap_reg_mx ());
list_push_back (&MailboxFormats, (void*) imap_reg_mx ());
-#endif
-#ifdef USE_POP
list_push_back (&MailboxFormats, (void*) pop_reg_mx ());
list_push_back (&MailboxFormats, (void*) pop_reg_mx ());
-#endif
#ifdef USE_NNTP
list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
#endif
#ifdef USE_NNTP
list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
#endif
-#ifdef USE_COMPRESSED
list_push_back (&MailboxFormats, (void*) compress_reg_mx ());
list_push_back (&MailboxFormats, (void*) compress_reg_mx ());
-#endif
#ifdef DEBUG
/* check module registration for completeness with debug versions */
#define EXITWITHERR(m) do { fprintf(stderr, "error: incomplete mx module: %s is missing for type %i\n",m,i);exit(1); } while (0)
#ifdef DEBUG
/* check module registration for completeness with debug versions */
#define EXITWITHERR(m) do { fprintf(stderr, "error: incomplete mx module: %s is missing for type %i\n",m,i);exit(1); } while (0)
@@
-1462,11
+1405,7
@@
int mx_rebuild_cache (void) {
for (i = 0; i < Incoming->length; i++) {
b = (BUFFY*) Incoming->data[i];
magic = mx_get_magic (b->path);
for (i = 0; i < Incoming->length; i++) {
b = (BUFFY*) Incoming->data[i];
magic = mx_get_magic (b->path);
- if (magic != M_MAILDIR && magic != M_MH
-#ifdef USE_IMAP
- && magic != M_IMAP
-#endif
- )
+ if (magic != M_MAILDIR && magic != M_MH && magic != M_IMAP)
continue;
sidebar_set_current (b->path);
sidebar_draw (CurrentMenu);
continue;
sidebar_set_current (b->path);
sidebar_draw (CurrentMenu);