From a19e52661bb5f4e6d34c803f469f6835c309e06a Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Thu, 10 Aug 2017 18:18:18 -0700 Subject: Create ATTACH_CONTEXT to hold attachment index. (see #3728) Move the idx and idxlen into ATTACH_CONTEXT. In subsequence patches, this structure will hold more useful items, such as the virtual index. The swap out is straightforward, except for: * update_idx() in compose.c, which post-increments the idxlen in the call and again in the function. * mutt_gen_attach_list() which doesn't need to returns the new values. --- attach.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'attach.c') diff --git a/attach.c b/attach.c index 3898fa39..2546e117 100644 --- a/attach.c +++ b/attach.c @@ -1042,3 +1042,20 @@ int mutt_print_attachment (FILE *fp, BODY *a) return 0; } } + +void mutt_free_attach_context (ATTACH_CONTEXT **pactx) +{ + int i; + ATTACH_CONTEXT *actx = *pactx; + + for (i = 0; i < actx->idxlen; i++) + { + if (actx->idx[i]->content) + actx->idx[i]->content->aptr = NULL; + FREE (&actx->idx[i]->tree); + FREE (&actx->idx[i]); + } + FREE (&actx->idx); + + FREE (pactx); /* __FREE_CHECKED__ */ +} -- cgit v1.2.3