From 81c5f887485a3d46ec5948832acc7da8167b5248 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 3 Mar 2004 01:57:43 +0000 Subject: macrofree av_freep() Originally committed as revision 2839 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 3 +-- libavcodec/utils.c | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index b29653ec9f..956a2ef74a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2073,8 +2073,7 @@ void *av_mallocz(unsigned int size); void *av_realloc(void *ptr, unsigned int size); void av_free(void *ptr); char *av_strdup(const char *s); -void __av_freep(void **ptr); -#define av_freep(p) __av_freep((void **)(p)) +void av_freep(void *ptr); void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); /* for static data only */ /* call av_free_static to release all staticaly allocated tables */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 7227e4f507..9fadfcd969 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -103,9 +103,13 @@ void av_free_static(void) last_static = 0; } -/* cannot call it directly because of 'void **' casting is not automatic */ -void __av_freep(void **ptr) +/** + * Frees memory and sets the pointer to NULL. + * @param arg pointer to the pointer which should be freed + */ +void av_freep(void *arg) { + void **ptr= (void**)arg; av_free(*ptr); *ptr = NULL; } -- cgit v1.2.3