changeset 400:b0aed401a756 libavcodec

better av_freep()
author glantau
date Mon, 20 May 2002 16:23:27 +0000
parents 64247fd53524
children e20655449d4a
files common.h utils.c
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/common.h	Mon May 20 16:22:51 2002 +0000
+++ b/common.h	Mon May 20 16:23:27 2002 +0000
@@ -57,14 +57,6 @@
 
 #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 @@
 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);
--- a/utils.c	Mon May 20 16:22:51 2002 +0000
+++ b/utils.c	Mon May 20 16:23:27 2002 +0000
@@ -65,6 +65,13 @@
         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;