summaryrefslogtreecommitdiffstats
path: root/attach.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-08-10 18:18:18 -0700
committerKevin McCarthy <kevin@8t8.us>2017-08-10 18:18:18 -0700
commita19e52661bb5f4e6d34c803f469f6835c309e06a (patch)
treebb6d0f16ff3fc33e256d2088e19330818e1469e7 /attach.c
parent8295a531a385e4dc769a43654e06e1f2c344129c (diff)
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.
Diffstat (limited to 'attach.c')
-rw-r--r--attach.c17
1 files changed, 17 insertions, 0 deletions
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__ */
+}