From 3433587a5a77ef94806236cbeb6181df71440928 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Thu, 10 Aug 2017 18:18:19 -0700 Subject: Change helpers functions to pass actx. (see #3728) Change the pager, compose, recvattach and recvcmd to pass the actx instead of the individual idx and idxlen parameters. Separate out the compose menu exit logic to first free the BODY data and then call the shared actx free function at the bottom. --- attach.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'attach.c') diff --git a/attach.c b/attach.c index 2546e117..7a512419 100644 --- a/attach.c +++ b/attach.c @@ -330,7 +330,7 @@ void mutt_check_lookup_list (BODY *b, char *type, int len) /* returns -1 on error, 0 or the return code from mutt_do_pager() on success */ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, - ATTACHPTR **idx, short idxlen) + ATTACH_CONTEXT *actx) { char tempfile[_POSIX_PATH_MAX] = ""; char pagerfile[_POSIX_PATH_MAX] = ""; @@ -571,8 +571,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, info.fp = fp; info.bdy = a; info.ctx = Context; - info.idx = idx; - info.idxlen = idxlen; + info.actx = actx; info.hdr = hdr; rc = mutt_do_pager (descrip, pagerfile, @@ -1046,7 +1045,12 @@ int mutt_print_attachment (FILE *fp, BODY *a) void mutt_free_attach_context (ATTACH_CONTEXT **pactx) { int i; - ATTACH_CONTEXT *actx = *pactx; + ATTACH_CONTEXT *actx; + + if (!pactx || !*pactx) + return; + + actx = *pactx; for (i = 0; i < actx->idxlen; i++) { -- cgit v1.2.3