diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2016-03-22 21:42:01 -0700 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2016-03-30 05:48:01 -0700 |
commit | 872d0838a4040e6ed275e4510741c8a54035ff73 (patch) | |
tree | 011f46d67a0b4d513387ede0eb7c553ad61da0a0 /ta/ta_talloc.h | |
parent | 3984d2acca22465f8cbe7276134c1be1963af4fb (diff) | |
download | mpv-872d0838a4040e6ed275e4510741c8a54035ff73.tar.bz2 mpv-872d0838a4040e6ed275e4510741c8a54035ff73.tar.xz |
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.
Diffstat (limited to 'ta/ta_talloc.h')
-rw-r--r-- | ta/ta_talloc.h | 2 |
1 files changed, 2 insertions, 0 deletions
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])) |