projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rocco Rutte:
[apps/madmutt.git]
/
compress.c
diff --git
a/compress.c
b/compress.c
index
b7439f6
..
e179b7d
100644
(file)
--- a/
compress.c
+++ b/
compress.c
@@
-18,6
+18,7
@@
#include "lib/mem.h"
#include "lib/intl.h"
#include "lib/str.h"
#include "lib/mem.h"
#include "lib/intl.h"
#include "lib/str.h"
+#include "lib/debug.h"
#include <errno.h>
#include <string.h>
#include <errno.h>
#include <string.h>
@@
-112,7
+113,7
@@
static COMPRESS_INFO *set_compress_info (CONTEXT * ctx)
COMPRESS_INFO *ci;
/* Now lets uncompress this thing */
COMPRESS_INFO *ci;
/* Now lets uncompress this thing */
- ci =
safe
_malloc (sizeof (COMPRESS_INFO));
+ ci =
mem
_malloc (sizeof (COMPRESS_INFO));
ctx->compressinfo = (void *) ci;
ci->append = find_compress_hook (M_APPENDHOOK, ctx->path);
ci->open = find_compress_hook (M_OPENHOOK, ctx->path);
ctx->compressinfo = (void *) ci;
ci->append = find_compress_hook (M_APPENDHOOK, ctx->path);
ci->open = find_compress_hook (M_OPENHOOK, ctx->path);
@@
-129,7
+130,7
@@
static void set_path (CONTEXT * ctx)
/* Uncompress to /tmp */
mutt_mktemp (tmppath);
/* Uncompress to /tmp */
mutt_mktemp (tmppath);
- ctx->path =
safe_malloc (safe_str
len (tmppath) + 1);
+ ctx->path =
mem_malloc (str_
len (tmppath) + 1);
strcpy (ctx->path, tmppath);
}
strcpy (ctx->path, tmppath);
}
@@
-188,7
+189,7
@@
static char *get_compression_cmd (const char *cmd, const CONTEXT * ctx)
mutt_FormatString (expanded, sizeof (expanded), cmd,
compresshook_format_str, (unsigned long) ctx, 0);
mutt_FormatString (expanded, sizeof (expanded), cmd,
compresshook_format_str, (unsigned long) ctx, 0);
- return s
afe_str
dup (expanded);
+ return s
tr_
dup (expanded);
}
int mutt_check_mailbox_compressed (CONTEXT * ctx)
}
int mutt_check_mailbox_compressed (CONTEXT * ctx)
@@
-196,8
+197,8
@@
int mutt_check_mailbox_compressed (CONTEXT * ctx)
COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
if (ci->size != get_size (ctx->realpath)) {
COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
if (ci->size != get_size (ctx->realpath)) {
-
FREE
(&ctx->compressinfo);
-
FREE
(&ctx->realpath);
+
mem_free
(&ctx->compressinfo);
+
mem_free
(&ctx->realpath);
mutt_error _("Mailbox was corrupted!");
return (-1);
mutt_error _("Mailbox was corrupted!");
return (-1);
@@
-215,7
+216,7
@@
int mutt_open_read_compressed (CONTEXT * ctx)
if (!ci->open) {
ctx->magic = 0;
if (!ci->open) {
ctx->magic = 0;
-
FREE
(ctx->compressinfo);
+
mem_free
(ctx->compressinfo);
return (-1);
}
if (!ci->close || access (ctx->path, W_OK) != 0)
return (-1);
}
if (!ci->close || access (ctx->path, W_OK) != 0)
@@
-230,11
+231,11
@@
int mutt_open_read_compressed (CONTEXT * ctx)
cmd = get_compression_cmd (ci->open, ctx);
if (cmd == NULL)
return (-1);
cmd = get_compression_cmd (ci->open, ctx);
if (cmd == NULL)
return (-1);
- d
print (2, (debugfile,
"DecompressCmd: '%s'\n", cmd));
+ d
ebug_print (2, (
"DecompressCmd: '%s'\n", cmd));
if ((fp = fopen (ctx->realpath, "r")) == NULL) {
mutt_perror (ctx->realpath);
if ((fp = fopen (ctx->realpath, "r")) == NULL) {
mutt_perror (ctx->realpath);
-
FREE
(&cmd);
+
mem_free
(&cmd);
return (-1);
}
mutt_block_signals ();
return (-1);
}
mutt_block_signals ();
@@
-243,7
+244,7
@@
int mutt_open_read_compressed (CONTEXT * ctx)
mutt_unblock_signals ();
mutt_error _("Unable to lock mailbox!");
mutt_unblock_signals ();
mutt_error _("Unable to lock mailbox!");
-
FREE
(&cmd);
+
mem_free
(&cmd);
return (-1);
}
return (-1);
}
@@
-259,11
+260,11
@@
int mutt_open_read_compressed (CONTEXT * ctx)
if (rc) {
mutt_any_key_to_continue (NULL);
ctx->magic = 0;
if (rc) {
mutt_any_key_to_continue (NULL);
ctx->magic = 0;
-
FREE
(ctx->compressinfo);
+
mem_free
(ctx->compressinfo);
mutt_error (_("Error executing: %s : unable to open the mailbox!\n"),
cmd);
}
mutt_error (_("Error executing: %s : unable to open the mailbox!\n"),
cmd);
}
-
FREE
(&cmd);
+
mem_free
(&cmd);
if (rc)
return (-1);
if (rc)
return (-1);
@@
-277,7
+278,7
@@
int mutt_open_read_compressed (CONTEXT * ctx)
void restore_path (CONTEXT * ctx)
{
void restore_path (CONTEXT * ctx)
{
-
FREE
(&ctx->path);
+
mem_free
(&ctx->path);
ctx->path = ctx->realpath;
}
ctx->path = ctx->realpath;
}
@@
-298,7
+299,7
@@
int mutt_open_append_compressed (CONTEXT * ctx)
return (mutt_open_read_compressed (ctx));
ctx->magic = 0;
return (mutt_open_read_compressed (ctx));
ctx->magic = 0;
-
FREE
(&ctx->compressinfo);
+
mem_free
(&ctx->compressinfo);
return (-1);
}
return (-1);
}
@@
-318,8
+319,7
@@
int mutt_open_append_compressed (CONTEXT * ctx)
/* close a compressed mailbox */
void mutt_fast_close_compressed (CONTEXT * ctx)
{
/* close a compressed mailbox */
void mutt_fast_close_compressed (CONTEXT * ctx)
{
- dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n",
- ctx->path));
+ debug_print (2, ("called on '%s'\n", ctx->path));
if (ctx->compressinfo) {
if (ctx->fp)
if (ctx->compressinfo) {
if (ctx->fp)
@@
-332,7
+332,7
@@
void mutt_fast_close_compressed (CONTEXT * ctx)
remove_file (ctx);
restore_path (ctx);
remove_file (ctx);
restore_path (ctx);
-
FREE
(&ctx->compressinfo);
+
mem_free
(&ctx->compressinfo);
}
}
}
}
@@
-353,7
+353,7
@@
int mutt_sync_compressed (CONTEXT * ctx)
if ((fp = fopen (ctx->realpath, "a")) == NULL) {
mutt_perror (ctx->realpath);
if ((fp = fopen (ctx->realpath, "a")) == NULL) {
mutt_perror (ctx->realpath);
-
FREE
(&cmd);
+
mem_free
(&cmd);
return (-1);
}
mutt_block_signals ();
return (-1);
}
mutt_block_signals ();
@@
-364,11
+364,11
@@
int mutt_sync_compressed (CONTEXT * ctx)
store_size (ctx);
store_size (ctx);
-
FREE
(&cmd);
+
mem_free
(&cmd);
return (-1);
}
return (-1);
}
- d
print (2, (debugfile,
"CompressCommand: '%s'\n", cmd));
+ d
ebug_print (2, (
"CompressCommand: '%s'\n", cmd));
endwin ();
fflush (stdout);
endwin ();
fflush (stdout);
@@
-386,7
+386,7
@@
int mutt_sync_compressed (CONTEXT * ctx)
mutt_unblock_signals ();
fclose (fp);
mutt_unblock_signals ();
fclose (fp);
-
FREE
(&cmd);
+
mem_free
(&cmd);
store_size (ctx);
store_size (ctx);
@@
-400,8
+400,7
@@
int mutt_slow_close_compressed (CONTEXT * ctx)
char *cmd;
COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
char *cmd;
COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
- dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n",
- ctx->path));
+ debug_print (2, ("called on '%s'\n", ctx->path));
if (!(ctx->append && ((append = get_append_command (ctx->realpath, ctx))
|| (append = ci->close)))) { /* if we can not or should not append,
if (!(ctx->append && ((append = get_append_command (ctx->realpath, ctx))
|| (append = ci->close)))) { /* if we can not or should not append,
@@
-429,7
+428,7
@@
int mutt_slow_close_compressed (CONTEXT * ctx)
if ((fp = fopen (ctx->realpath, "a")) == NULL) {
mutt_perror (ctx->realpath);
if ((fp = fopen (ctx->realpath, "a")) == NULL) {
mutt_perror (ctx->realpath);
-
FREE
(&cmd);
+
mem_free
(&cmd);
return (-1);
}
mutt_block_signals ();
return (-1);
}
mutt_block_signals ();
@@
-438,11
+437,11
@@
int mutt_slow_close_compressed (CONTEXT * ctx)
mutt_unblock_signals ();
mutt_error _("Unable to lock mailbox!");
mutt_unblock_signals ();
mutt_error _("Unable to lock mailbox!");
-
FREE
(&cmd);
+
mem_free
(&cmd);
return (-1);
}
return (-1);
}
- d
print (2, (debugfile,
"CompressCmd: '%s'\n", cmd));
+ d
ebug_print (2, (
"CompressCmd: '%s'\n", cmd));
endwin ();
fflush (stdout);
endwin ();
fflush (stdout);
@@
-459,7
+458,7
@@
int mutt_slow_close_compressed (CONTEXT * ctx)
mutt_error (_
(" %s: Error compressing mailbox! Uncompressed one kept!\n"),
ctx->path);
mutt_error (_
(" %s: Error compressing mailbox! Uncompressed one kept!\n"),
ctx->path);
-
FREE
(&cmd);
+
mem_free
(&cmd);
mbox_unlock_compressed (ctx, fp);
mutt_unblock_signals ();
fclose (fp);
mbox_unlock_compressed (ctx, fp);
mutt_unblock_signals ();
fclose (fp);
@@
-471,14
+470,14
@@
int mutt_slow_close_compressed (CONTEXT * ctx)
fclose (fp);
remove_file (ctx);
restore_path (ctx);
fclose (fp);
remove_file (ctx);
restore_path (ctx);
-
FREE
(&cmd);
-
FREE
(&ctx->compressinfo);
+
mem_free
(&cmd);
+
mem_free
(&ctx->compressinfo);
return (0);
}
mx_t* compress_reg_mx (void) {
return (0);
}
mx_t* compress_reg_mx (void) {
- mx_t* fmt =
safe
_calloc (1, sizeof (mx_t));
+ mx_t* fmt =
mem
_calloc (1, sizeof (mx_t));
fmt->type = M_COMPRESSED;
fmt->local = 1;
fmt->mx_is_magic = mbox_is_magic;
fmt->type = M_COMPRESSED;
fmt->local = 1;
fmt->mx_is_magic = mbox_is_magic;