summaryrefslogtreecommitdiffstats
path: root/compose.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-08-10 18:18:19 -0700
committerKevin McCarthy <kevin@8t8.us>2017-08-10 18:18:19 -0700
commit3433587a5a77ef94806236cbeb6181df71440928 (patch)
tree2dbfdc6bbe6cd6701eb24270a246b9a038fa906e /compose.c
parenta19e52661bb5f4e6d34c803f469f6835c309e06a (diff)
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.
Diffstat (limited to 'compose.c')
-rw-r--r--compose.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/compose.c b/compose.c
index 2d84f0e3..183976e0 100644
--- a/compose.c
+++ b/compose.c
@@ -1340,18 +1340,13 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (!(flags & MUTT_COMPOSE_NOFREEHEADER))
{
- while (actx->idxlen-- > 0)
+ for (i = 0; i < actx->idxlen; i++)
{
/* avoid freeing other attachments */
- actx->idx[actx->idxlen]->content->next = NULL;
- actx->idx[actx->idxlen]->content->parts = NULL;
- mutt_free_body (&actx->idx[actx->idxlen]->content);
- FREE (&actx->idx[actx->idxlen]->tree);
- FREE (&actx->idx[actx->idxlen]);
+ actx->idx[i]->content->next = NULL;
+ actx->idx[i]->content->parts = NULL;
+ mutt_free_body (&actx->idx[i]->content);
}
- FREE (&actx->idx);
- actx->idxlen = 0;
- actx->idxmax = 0;
}
r = -1;
loop = 0;
@@ -1489,20 +1484,11 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
mutt_menuDestroy (&menu);
if (actx->idxlen)
- {
msg->content = actx->idx[0]->content;
- for (i = 0; i < actx->idxlen; i++)
- {
- actx->idx[i]->content->aptr = NULL;
- FREE (&actx->idx[i]->tree);
- FREE (&actx->idx[i]);
- }
- }
else
msg->content = NULL;
- FREE (&actx->idx);
- FREE (&actx);
+ mutt_free_attach_context (&actx);
return (r);
}