diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2002-05-20 16:23:27 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2002-05-20 16:23:27 +0000 |
commit | 4d7a0a0593918fc054065f7b545edef2d2981048 (patch) | |
tree | d4e9dbce8d4d08df94c20f8e1fe9497d3bcd97dc /libavcodec | |
parent | 51a4966370801e11e1a6b8c0de7c7d774d97503d (diff) | |
download | ffmpeg-4d7a0a0593918fc054065f7b545edef2d2981048.tar.gz |
better av_freep()
Originally committed as revision 541 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/common.h | 11 | ||||
-rw-r--r-- | libavcodec/utils.c | 7 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/common.h b/libavcodec/common.h index 5494555156..13018975c6 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -57,14 +57,6 @@ typedef INT32 int32_t; #define inline __inline -/* - Disable warning messages: - warning C4244: '=' : conversion from 'double' to 'float', possible loss of data - warning C4305: 'argument' : truncation from 'const double' to 'float' -*/ -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) - #else #define INT64_C(c) (c ## LL) #define UINT64_C(c) (c ## ULL) @@ -901,7 +893,8 @@ static inline int clip(int a, int amin, int amax) void *av_malloc(int size); void *av_mallocz(int size); void av_free(void *ptr); -#define av_freep(p) do { av_free(*p); *p = NULL; } while (0) +void __av_freep(void **ptr); +#define av_freep(p) __av_freep((void **)(p)) /* math */ int ff_gcd(int a, int b); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index cf94531760..43e39ebc93 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -65,6 +65,13 @@ void av_free(void *ptr) free(ptr); } +/* cannot call it directly because of 'void **' casting is not automatic */ +void __av_freep(void **ptr) +{ + av_free(*ptr); + *ptr = NULL; +} + /* encoder management */ AVCodec *first_avcodec; |