From 56075cc8cfa3bff5d5a31a15a587e1493fb91ba0 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sun, 13 Nov 2016 20:02:33 -0800 Subject: [PATCH] Compress: prefix external functions with "mutt_" Also, include compress.h in compress.c so the mx_comp_ops doesn't need to be redeclared. --- compress.c | 23 +++++++++++------------ compress.h | 8 ++++---- hook.c | 2 +- mx.c | 8 ++++---- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/compress.c b/compress.c index aadf0948..f42b09b1 100644 --- a/compress.c +++ b/compress.c @@ -29,6 +29,7 @@ #include "mailbox.h" #include "mutt_curses.h" #include "mx.h" +#include "compress.h" /* Notes: * Any references to compressed files also apply to encrypted files. @@ -465,8 +466,6 @@ or_fail: } -struct mx_ops mx_comp_ops; - /** * open_mailbox - Open a compressed mailbox * @ctx: Mailbox to open @@ -785,7 +784,7 @@ open_new_message (MESSAGE *msg, CONTEXT *ctx, HEADER *hdr) /** - * comp_can_append - Can we append to this path? + * mutt_comp_can_append - Can we append to this path? * @path: pathname of file to be tested * * To append to a file we can either use an 'append-hook' or a combination of @@ -798,7 +797,7 @@ open_new_message (MESSAGE *msg, CONTEXT *ctx, HEADER *hdr) * 0: No, appending isn't possible */ int -comp_can_append (CONTEXT *ctx) +mutt_comp_can_append (CONTEXT *ctx) { if (!ctx) return 0; @@ -818,7 +817,7 @@ comp_can_append (CONTEXT *ctx) } /** - * comp_can_read - Can we read from this file? + * mutt_comp_can_read - Can we read from this file? * @path: Pathname of file to be tested * * Search for an 'open-hook' with a regex that matches the path. @@ -830,7 +829,7 @@ comp_can_append (CONTEXT *ctx) * 0: No, we cannot read the file */ int -comp_can_read (const char *path) +mutt_comp_can_read (const char *path) { if (!path) return 0; @@ -842,18 +841,18 @@ comp_can_read (const char *path) } /** - * comp_sync - Save changes to the compressed mailbox file + * mutt_comp_sync - Save changes to the compressed mailbox file * @ctx: Mailbox to sync * - * Changes in Mutt only affect the tmp file. Calling comp_sync() will commit - * them to the compressed file. + * Changes in Mutt only affect the tmp file. Calling mutt_comp_sync() + * will commit them to the compressed file. * * Returns: * 0: Success * -1: Failure */ int -comp_sync (CONTEXT *ctx) +mutt_comp_sync (CONTEXT *ctx) { if (!ctx) return -1; @@ -878,7 +877,7 @@ comp_sync (CONTEXT *ctx) } /** - * comp_valid_command - Is this command string allowed? + * mutt_comp_valid_command - Is this command string allowed? * @cmd: Command string * * A valid command string must have both "%f" (from file) and "%t" (to file). @@ -889,7 +888,7 @@ comp_sync (CONTEXT *ctx) * 0: "%f" and/or "%t" is missing */ int -comp_valid_command (const char *cmd) +mutt_comp_valid_command (const char *cmd) { if (!cmd) return 0; diff --git a/compress.h b/compress.h index 26beae63..e41fe93e 100644 --- a/compress.h +++ b/compress.h @@ -19,10 +19,10 @@ #ifndef _COMPRESS_H_ #define _COMPRESS_H_ -int comp_can_append (CONTEXT *ctx); -int comp_can_read (const char *path); -int comp_sync (CONTEXT *ctx); -int comp_valid_command (const char *cmd); +int mutt_comp_can_append (CONTEXT *ctx); +int mutt_comp_can_read (const char *path); +int mutt_comp_sync (CONTEXT *ctx); +int mutt_comp_valid_command (const char *cmd); extern struct mx_ops mx_comp_ops; diff --git a/hook.c b/hook.c index d0a111b2..d8f678a8 100644 --- a/hook.c +++ b/hook.c @@ -115,7 +115,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) } #ifdef USE_COMPRESSED else if (data & (MUTT_APPENDHOOK | MUTT_OPENHOOK | MUTT_CLOSEHOOK)) { - if (comp_valid_command (command.data) == 0) { + if (mutt_comp_valid_command (command.data) == 0) { strfcpy (err->data, _("badly formatted command string"), err->dsize); return -1; } diff --git a/mx.c b/mx.c index fdb2a77c..a831d800 100644 --- a/mx.c +++ b/mx.c @@ -452,7 +452,7 @@ int mx_get_magic (const char *path) #ifdef USE_COMPRESSED /* If there are no other matches, see if there are any * compress hooks that match */ - if ((magic == 0) && comp_can_read (path)) + if ((magic == 0) && mutt_comp_can_read (path)) return MUTT_COMPRESSED; #endif return (magic); @@ -522,7 +522,7 @@ static int mx_open_mailbox_append (CONTEXT *ctx, int flags) } #ifdef USE_COMPRESSED - if (comp_can_append (ctx)) + if (mutt_comp_can_append (ctx)) ctx->mx_ops = &mx_comp_ops; else #endif @@ -722,9 +722,9 @@ static int sync_mailbox (CONTEXT *ctx, int *index_hint) #ifdef USE_COMPRESSED /* If everything went well, the mbox handler saved the changes to our - * temporary file. Next, comp_sync() will compress the temporary file. */ + * temporary file. Next, mutt_comp_sync() will compress the temporary file. */ if ((rc == 0) && ctx->compress_info) - return comp_sync (ctx); + return mutt_comp_sync (ctx); #endif return rc; -- 2.40.0