From 655a0c597bb7aa34d110c7bc2a4b4512f757604b Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Tue, 9 Apr 2019 18:54:20 -0700 Subject: [PATCH] Rename to mutt_rfc1524_expand_filename() Now that all callers pass a struct Buffer, the buffer prefix is not needed to distinguish the parameter. Co-authored-by: Richard Russon --- handler.c | 2 +- mutt_attach.c | 10 +++++----- rfc1524.c | 6 +++--- rfc1524.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/handler.c b/handler.c index 8a7ec223d..687682848 100644 --- a/handler.c +++ b/handler.c @@ -545,7 +545,7 @@ static int autoview_handler(struct Body *a, struct State *s) fname = mutt_str_strdup(a->filename); mutt_file_sanitize_filename(fname, true); - mutt_buffer_rfc1524_expand_filename(entry->nametemplate, fname, tempfile); + mutt_rfc1524_expand_filename(entry->nametemplate, fname, tempfile); FREE(&fname); if (entry->command) diff --git a/mutt_attach.c b/mutt_attach.c index b76090e71..02449aa71 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -76,7 +76,7 @@ int mutt_get_tmp_attachment(struct Body *a) struct Rfc1524MailcapEntry *entry = rfc1524_new_entry(); snprintf(type, sizeof(type), "%s/%s", TYPE(a), a->subtype); rfc1524_mailcap_lookup(a, type, entry, MUTT_MC_NO_FLAGS); - mutt_buffer_rfc1524_expand_filename(entry->nametemplate, a->filename, tmpfile); + mutt_rfc1524_expand_filename(entry->nametemplate, a->filename, tmpfile); rfc1524_free_entry(&entry); @@ -134,7 +134,7 @@ int mutt_compose_attachment(struct Body *a) else mutt_buffer_strcpy(cmd, entry->composecommand); - if (mutt_buffer_rfc1524_expand_filename(entry->nametemplate, a->filename, newfile)) + if (mutt_rfc1524_expand_filename(entry->nametemplate, a->filename, newfile)) { mutt_debug(LL_DEBUG1, "oldfile: %s\t newfile: %s\n", a->filename, mutt_b2s(newfile)); if (mutt_file_symlink(a->filename, mutt_b2s(newfile)) == -1) @@ -271,7 +271,7 @@ int mutt_edit_attachment(struct Body *a) if (entry->editcommand) { mutt_buffer_strcpy(cmd, entry->editcommand); - if (mutt_buffer_rfc1524_expand_filename(entry->nametemplate, a->filename, newfile)) + if (mutt_rfc1524_expand_filename(entry->nametemplate, a->filename, newfile)) { mutt_debug(LL_DEBUG1, "oldfile: %s\t newfile: %s\n", a->filename, mutt_b2s(newfile)); if (mutt_file_symlink(a->filename, mutt_b2s(newfile)) == -1) @@ -454,7 +454,7 @@ int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, else fname = a->filename; - if (mutt_buffer_rfc1524_expand_filename(entry->nametemplate, fname, tmpfile)) + if (mutt_rfc1524_expand_filename(entry->nametemplate, fname, tmpfile)) { if (!fp && (mutt_str_strcmp(mutt_b2s(tmpfile), a->filename) != 0)) { @@ -1054,7 +1054,7 @@ int mutt_print_attachment(FILE *fp, struct Body *a) struct Rfc1524MailcapEntry *entry = rfc1524_new_entry(); rfc1524_mailcap_lookup(a, type, entry, MUTT_MC_PRINT); - if (mutt_buffer_rfc1524_expand_filename(entry->nametemplate, a->filename, newfile)) + if (mutt_rfc1524_expand_filename(entry->nametemplate, a->filename, newfile)) { if (!fp) { diff --git a/rfc1524.c b/rfc1524.c index d7ac2d0d8..7c074263c 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -513,7 +513,7 @@ bool rfc1524_mailcap_lookup(struct Body *a, char *type, } /** - * mutt_buffer_rfc1524_expand_filename - Expand a new filename from a template or existing filename + * mutt_rfc1524_expand_filename - Expand a new filename from a template or existing filename * @param nametemplate Template * @param oldfile Original filename * @param newfile Buffer for new filename @@ -530,8 +530,8 @@ bool rfc1524_mailcap_lookup(struct Body *a, char *type, * for a "%s". If none is found, the nametemplate is used as the template for * newfile. The first path component of the nametemplate and oldfile are ignored. */ -int mutt_buffer_rfc1524_expand_filename(const char *nametemplate, - const char *oldfile, struct Buffer *newfile) +int mutt_rfc1524_expand_filename(const char *nametemplate, const char *oldfile, + struct Buffer *newfile) { int i, j, k; char *s = NULL; diff --git a/rfc1524.h b/rfc1524.h index c62c4b062..491dd2890 100644 --- a/rfc1524.h +++ b/rfc1524.h @@ -64,7 +64,7 @@ enum MailcapLookup struct Rfc1524MailcapEntry *rfc1524_new_entry(void); void rfc1524_free_entry(struct Rfc1524MailcapEntry **entry); int rfc1524_expand_command(struct Body *a, const char *filename, const char *type, char *command, int clen); -int mutt_buffer_rfc1524_expand_filename(const char *nametemplate, const char *oldfile, struct Buffer *newfile); +int mutt_rfc1524_expand_filename(const char *nametemplate, const char *oldfile, struct Buffer *newfile); bool rfc1524_mailcap_lookup(struct Body *a, char *type, struct Rfc1524MailcapEntry *entry, enum MailcapLookup opt); int mutt_buffer_rfc1524_expand_command(struct Body *a, const char *filename, const char *type, struct Buffer *command); -- 2.40.0