On 24/4/20 2:40 pm, Anatol Pomozov wrote:
It frees all the dynamically allocated fields plus the struct itself
How many times will you use this? Across how many functions? We usually #unset defines not used globally too.
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> --- lib/libalpm/dload.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h index a40b51b7..3f2fb9ea 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -56,6 +56,11 @@ void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload); int _alpm_download(struct dload_payload *payload, const char *localpath, char **final_file, const char **final_url);
+#define DLOAD_PAYLOAD_FREE(payload) { \ + _alpm_dload_payload_reset(payload); \ + FREE(payload); \ +} + int _alpm_multi_download(alpm_handle_t *handle, alpm_list_t *payloads /* struct dload_payload */, const char *localpath);