changeset 27299:4e57d47ee5db

Cleanup, use av_freep() instead of av_free(x); x=NULL
author michael
date Mon, 21 Jul 2008 11:18:24 +0000
parents 0de5b595d2ae
children 181f489ead9d
files libswscale/swscale.c
diffstat 1 files changed, 22 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Sat Jul 19 11:32:33 2008 +0000
+++ b/libswscale/swscale.c	Mon Jul 21 11:18:24 2008 +0000
@@ -1144,7 +1144,7 @@
 
         if (outVec != &scaleFilter) sws_freeVec(outVec);
     }
-    av_free(filter); filter=NULL;
+    av_freep(&filter);
 
     /* try to reduce the filter-size (step1 find size and shift left) */
     // Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
@@ -1228,7 +1228,7 @@
             else               filter[i*filterSize + j]= filter2[i*filter2Size + j];
         }
     }
-    av_free(filter2); filter2=NULL;
+    av_freep(&filter2);
 
 
     //FIXME try to align filterpos if possible
@@ -2821,8 +2821,7 @@
 
 void sws_freeVec(SwsVector *a){
     if (!a) return;
-    av_free(a->coeff);
-    a->coeff=NULL;
+    av_freep(&a->coeff);
     a->length=0;
     av_free(a);
 }
@@ -2845,48 +2844,30 @@
     if (c->lumPixBuf)
     {
         for (i=0; i<c->vLumBufSize; i++)
-        {
-            av_free(c->lumPixBuf[i]);
-            c->lumPixBuf[i]=NULL;
-        }
-        av_free(c->lumPixBuf);
-        c->lumPixBuf=NULL;
+            av_freep(&c->lumPixBuf[i]);
+        av_freep(&c->lumPixBuf);
     }
 
     if (c->chrPixBuf)
     {
         for (i=0; i<c->vChrBufSize; i++)
-        {
-            av_free(c->chrPixBuf[i]);
-            c->chrPixBuf[i]=NULL;
-        }
-        av_free(c->chrPixBuf);
-        c->chrPixBuf=NULL;
+            av_freep(&c->chrPixBuf[i]);
+        av_freep(&c->chrPixBuf);
     }
 
-    av_free(c->vLumFilter);
-    c->vLumFilter = NULL;
-    av_free(c->vChrFilter);
-    c->vChrFilter = NULL;
-    av_free(c->hLumFilter);
-    c->hLumFilter = NULL;
-    av_free(c->hChrFilter);
-    c->hChrFilter = NULL;
+    av_freep(&c->vLumFilter);
+    av_freep(&c->vChrFilter);
+    av_freep(&c->hLumFilter);
+    av_freep(&c->hChrFilter);
 #ifdef HAVE_ALTIVEC
-    av_free(c->vYCoeffsBank);
-    c->vYCoeffsBank = NULL;
-    av_free(c->vCCoeffsBank);
-    c->vCCoeffsBank = NULL;
+    av_freep(&c->vYCoeffsBank);
+    av_freep(&c->vCCoeffsBank);
 #endif
 
-    av_free(c->vLumFilterPos);
-    c->vLumFilterPos = NULL;
-    av_free(c->vChrFilterPos);
-    c->vChrFilterPos = NULL;
-    av_free(c->hLumFilterPos);
-    c->hLumFilterPos = NULL;
-    av_free(c->hChrFilterPos);
-    c->hChrFilterPos = NULL;
+    av_freep(&c->vLumFilterPos);
+    av_freep(&c->vChrFilterPos);
+    av_freep(&c->hLumFilterPos);
+    av_freep(&c->hChrFilterPos);
 
 #if defined(ARCH_X86) && defined(CONFIG_GPL)
 #ifdef MAP_ANONYMOUS
@@ -2900,16 +2881,11 @@
     c->funnyUVCode=NULL;
 #endif /* defined(ARCH_X86) */
 
-    av_free(c->lumMmx2Filter);
-    c->lumMmx2Filter=NULL;
-    av_free(c->chrMmx2Filter);
-    c->chrMmx2Filter=NULL;
-    av_free(c->lumMmx2FilterPos);
-    c->lumMmx2FilterPos=NULL;
-    av_free(c->chrMmx2FilterPos);
-    c->chrMmx2FilterPos=NULL;
-    av_free(c->yuvTable);
-    c->yuvTable=NULL;
+    av_freep(&c->lumMmx2Filter);
+    av_freep(&c->chrMmx2Filter);
+    av_freep(&c->lumMmx2FilterPos);
+    av_freep(&c->chrMmx2FilterPos);
+    av_freep(&c->yuvTable);
 
     av_free(c);
 }