From 872d0838a4040e6ed275e4510741c8a54035ff73 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Tue, 22 Mar 2016 21:42:01 -0700 Subject: ta: add TA_FREEP macro This sets the pointer to NULL after talloc_freeing it. This emulates the av_freep function for ta_talloc, but with a macro instead. --- ta/ta_talloc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ta') diff --git a/ta/ta_talloc.h b/ta/ta_talloc.h index 2331b4e08e..7194b86601 100644 --- a/ta/ta_talloc.h +++ b/ta/ta_talloc.h @@ -73,6 +73,8 @@ char *ta_talloc_asprintf_append_buffer(char *s, const char *fmt, ...) TA_PRF(2, // mpv specific stuff - should be made part of proper TA API +#define TA_FREEP(pctx) do {if (pctx) {talloc_free(*pctx); (*pctx) = NULL;}} while(0) + #define TA_EXPAND_ARGS(...) __VA_ARGS__ #define MP_TALLOC_AVAIL(p) (talloc_get_size(p) / sizeof((p)[0])) -- cgit v1.2.3