Fix duplicate definitions of FREE
authorClément Stenac <zorglub@videolan.org>
Thu, 3 Aug 2006 15:34:08 +0000 (15:34 +0000)
committerClément Stenac <zorglub@videolan.org>
Thu, 3 Aug 2006 15:34:08 +0000 (15:34 +0000)
25 files changed:
modules/access/dvb/dvb.h
modules/access/dvb/http.c
modules/access/mms/mms.h
modules/access/mms/mmstu.c
modules/access/vcdx/access.c
modules/access_output/http.c
modules/codec/cinepak.c
modules/demux/asf/libasf.c
modules/demux/avi/avi.c
modules/demux/mp4/libmp4.c
modules/demux/mp4/mp4.c
modules/demux/playlist/asx.c
modules/demux/playlist/b4s.c
modules/demux/playlist/qtl.c
modules/demux/playlist/shoutcast.c
modules/gui/wxwidgets/dialogs/interaction.cpp
modules/mux/ogg.c
modules/services_discovery/sap.c
modules/stream_out/es.c
modules/video_filter/logo.c
modules/video_output/image.c
src/misc/vlm.c
src/stream_output/announce.c
src/stream_output/sap.c
src/stream_output/stream_output.c

index 75d9754..993b66d 100644 (file)
@@ -97,39 +97,34 @@ static __inline__ void en50221_MMIFree( en50221_mmi_object_t *p_object )
 {
     int i;
 
-#define FREE( x )                                                           \
-    if ( x != NULL )                                                        \
-        free( x );
-
     switch ( p_object->i_object_type )
     {
     case EN50221_MMI_ENQ:
-        FREE( p_object->u.enq.psz_text );
+        FREENULL( p_object->u.enq.psz_text );
         break;
 
     case EN50221_MMI_ANSW:
         if ( p_object->u.answ.b_ok )
         {
-            FREE( p_object->u.answ.psz_answ );
+            FREENULL( p_object->u.answ.psz_answ );
         }
         break;
 
     case EN50221_MMI_MENU:
     case EN50221_MMI_LIST:
-        FREE( p_object->u.menu.psz_title );
-        FREE( p_object->u.menu.psz_subtitle );
-        FREE( p_object->u.menu.psz_bottom );
+        FREENULL( p_object->u.menu.psz_title );
+        FREENULL( p_object->u.menu.psz_subtitle );
+        FREENULL( p_object->u.menu.psz_bottom );
         for ( i = 0; i < p_object->u.menu.i_choices; i++ )
         {
-            FREE( p_object->u.menu.ppsz_choices[i] );
+            FREENULL( p_object->u.menu.ppsz_choices[i] );
         }
-        FREE( p_object->u.menu.ppsz_choices );
+        FREENULL( p_object->u.menu.ppsz_choices );
         break;
 
     default:
         break;
     }
-#undef FREE
 }
 
 #define MAX_DEMUX 256
index 1cf69b9..147f9bc 100644 (file)
@@ -77,10 +77,6 @@ static int HttpCallback( httpd_file_sys_t *p_args,
  *****************************************************************************/
 int E_(HTTPOpen)( access_t *p_access )
 {
-#define FREE( x )                                                           \
-    if ( (x) != NULL )                                                      \
-        free( x );
-
     access_sys_t *p_sys = p_access->p_sys;
     char          *psz_address, *psz_cert = NULL, *psz_key = NULL,
                   *psz_ca = NULL, *psz_crl = NULL, *psz_user = NULL,
@@ -196,8 +192,6 @@ int E_(HTTPOpen)( access_t *p_access )
     p_sys->p_httpd_redir = httpd_RedirectNew( p_sys->p_httpd_host,
                                               "/index.html", "/" );
 
-#undef FREE
-
     return VLC_SUCCESS;
 }
 
index f635892..ddc0bfd 100644 (file)
@@ -34,5 +34,3 @@ void E_( MMSTUClose ) ( access_t * );
 /* mmsh */
 int  E_( MMSHOpen )  ( access_t * );
 void E_( MMSHClose ) ( access_t * );
-
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
index 457ab56..4bdf9a5 100644 (file)
@@ -912,14 +912,14 @@ static void MMSClose( access_t  *p_access )
         net_Close( p_sys->i_handle_udp );
     }
 
-    FREE( p_sys->p_cmd );
-    FREE( p_sys->p_media );
-    FREE( p_sys->p_header );
-
-    FREE( p_sys->psz_server_version );
-    FREE( p_sys->psz_tool_version );
-    FREE( p_sys->psz_update_player_url );
-    FREE( p_sys->psz_encryption_type );
+    FREENULL( p_sys->p_cmd );
+    FREENULL( p_sys->p_media );
+    FREENULL( p_sys->p_header );
+
+    FREENULL( p_sys->psz_server_version );
+    FREENULL( p_sys->psz_tool_version );
+    FREENULL( p_sys->psz_update_player_url );
+    FREENULL( p_sys->psz_encryption_type );
 }
 
 /****************************************************************************
@@ -1271,7 +1271,7 @@ static int  mms_ParsePacket( access_t *p_access,
     }
     else
     {
-        FREE( p_sys->p_media );
+        FREENULL( p_sys->p_media );
         p_sys->p_media = p_packet;
         p_sys->i_media = i_packet_length - 8;
         p_sys->i_media_used = 0;
index 5161fd4..2febf8c 100644 (file)
@@ -44,8 +44,6 @@
 #include "info.h"
 #include "intf.h"
 
-#define FREE_AND_NULL(ptr) free(ptr); ptr = NULL;
-
 extern void VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
                           const vcdinfo_itemid_t *p_itemid );
 
@@ -1002,14 +1000,14 @@ VCDClose ( vlc_object_t *p_this )
 
     if( p_vcdplayer->p_input ) vlc_object_release( p_vcdplayer->p_input );
 
-    FREE_AND_NULL( p_vcdplayer->p_entries );
-    FREE_AND_NULL( p_vcdplayer->p_segments );
-    FREE_AND_NULL( p_vcdplayer->psz_source );
-    FREE_AND_NULL( p_vcdplayer->track );
-    FREE_AND_NULL( p_vcdplayer->segment );
-    FREE_AND_NULL( p_vcdplayer->entry );
-    FREE_AND_NULL( p_access->psz_demux );
-    FREE_AND_NULL( p_vcdplayer );
+    FREENULL( p_vcdplayer->p_entries );
+    FREENULL( p_vcdplayer->p_segments );
+    FREENULL( p_vcdplayer->psz_source );
+    FREENULL( p_vcdplayer->track );
+    FREENULL( p_vcdplayer->segment );
+    FREENULL( p_vcdplayer->entry );
+    FREENULL( p_access->psz_demux );
+    FREENULL( p_vcdplayer );
     p_vcd_access    = NULL;
 }
 
index 9780db5..09be152 100644 (file)
@@ -44,8 +44,6 @@
 
 #include "vlc_httpd.h"
 
-#define FREE( p ) if( p ) { free( p); (p) = NULL; }
-
 #define DEFAULT_PORT        8080
 #define DEFAULT_SSL_PORT    8443
 
index 8bad531..a64852e 100644 (file)
@@ -225,9 +225,6 @@ static void CloseDecoder( vlc_object_t *p_this )
 #define GET4BYTES( p ) \
     GetDWBE( p ); p+= 4;
 
-#define FREE( p ) \
-    if( p ) free( p )
-
 static void cinepak_LoadCodebook( cinepak_codebook_t *p_codebook,
                                   uint8_t *p_data, int b_grayscale )
 {
index 4ece93e..5c45fb6 100644 (file)
@@ -32,9 +32,6 @@
 
 #define ASF_DEBUG 1
 
-#define FREE( p ) \
-    if( p ) {free( p ); p = NULL; }
-
 #define GUID_FMT "0x%x-0x%x-0x%x-0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
 #define GUID_PRINT( guid )  \
     (guid).v1,              \
@@ -243,7 +240,7 @@ static void ASF_FreeObject_Index( asf_object_t *p_obj )
 {
     asf_object_index_t *p_index = (asf_object_index_t*)p_obj;
 
-    FREE( p_index->index_entry );
+    FREENULL( p_index->index_entry );
 }
 
 static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj )
@@ -485,7 +482,7 @@ static void ASF_FreeObject_header_extension( asf_object_t *p_obj )
     asf_object_header_extension_t *p_he =
         (asf_object_header_extension_t *)p_obj;
 
-    FREE( p_he->p_header_extension_data );
+    FREENULL( p_he->p_header_extension_data );
 }
 
 static int ASF_ReadObject_stream_properties( stream_t *s, asf_object_t *p_obj )
@@ -554,8 +551,8 @@ static void ASF_FreeObject_stream_properties( asf_object_t *p_obj )
     asf_object_stream_properties_t *p_sp =
                 (asf_object_stream_properties_t*)p_obj;
 
-    FREE( p_sp->p_type_specific_data );
-    FREE( p_sp->p_error_correction_data );
+    FREENULL( p_sp->p_type_specific_data );
+    FREENULL( p_sp->p_error_correction_data );
 }
 
 
@@ -658,12 +655,12 @@ static void ASF_FreeObject_codec_list( asf_object_t *p_obj )
     for( i_codec = 0; i_codec < p_cl->i_codec_entries_count; i_codec++ )
     {
 #define codec p_cl->codec[i_codec]
-        FREE( codec.psz_name );
-        FREE( codec.psz_description );
-        FREE( codec.p_information );
+        FREENULL( codec.psz_name );
+        FREENULL( codec.psz_description );
+        FREENULL( codec.p_information );
 #undef  codec
     }
-    FREE( p_cl->codec );
+    FREENULL( p_cl->codec );
 }
 
 /* Microsoft should go to hell. This time the length give number of bytes
@@ -734,11 +731,11 @@ static void ASF_FreeObject_content_description( asf_object_t *p_obj)
     asf_object_content_description_t *p_cd =
         (asf_object_content_description_t *)p_obj;
 
-    FREE( p_cd->psz_title );
-    FREE( p_cd->psz_author );
-    FREE( p_cd->psz_copyright );
-    FREE( p_cd->psz_description );
-    FREE( p_cd->psz_rating );
+    FREENULL( p_cd->psz_title );
+    FREENULL( p_cd->psz_author );
+    FREENULL( p_cd->psz_copyright );
+    FREENULL( p_cd->psz_description );
+    FREENULL( p_cd->psz_rating );
 }
 
 /* Language list: */
@@ -795,8 +792,8 @@ static void ASF_FreeObject_language_list( asf_object_t *p_obj)
     int i;
 
     for( i = 0; i < p_ll->i_language; i++ )
-        FREE( p_ll->ppsz_language[i] );
-    FREE( p_ll->ppsz_language );
+        FREENULL( p_ll->ppsz_language[i] );
+    FREENULL( p_ll->ppsz_language );
 }
 
 /* Stream bitrate properties */
@@ -958,9 +955,9 @@ static void ASF_FreeObject_extended_stream_properties( asf_object_t *p_obj)
     int i;
 
     for( i = 0; i < p_esp->i_stream_name_count; i++ )
-        FREE( p_esp->ppsz_stream_name[i] );
-    FREE( p_esp->pi_stream_name_language );
-    FREE( p_esp->ppsz_stream_name );
+        FREENULL( p_esp->ppsz_stream_name[i] );
+    FREENULL( p_esp->pi_stream_name_language );
+    FREENULL( p_esp->ppsz_stream_name );
 }
 
 
@@ -1002,7 +999,7 @@ static void ASF_FreeObject_advanced_mutual_exclusion( asf_object_t *p_obj)
     asf_object_advanced_mutual_exclusion_t *p_ae =
         (asf_object_advanced_mutual_exclusion_t *)p_obj;
 
-    FREE( p_ae->pi_stream_number );
+    FREENULL( p_ae->pi_stream_number );
 }
 
 
@@ -1046,8 +1043,8 @@ static void ASF_FreeObject_stream_prioritization( asf_object_t *p_obj)
     asf_object_stream_prioritization_t *p_sp =
         (asf_object_stream_prioritization_t *)p_obj;
 
-    FREE( p_sp->pi_priority_stream_number );
-    FREE( p_sp->pi_priority_flag );
+    FREENULL( p_sp->pi_priority_stream_number );
+    FREENULL( p_sp->pi_priority_flag );
 }
 
 
@@ -1153,8 +1150,8 @@ static void ASF_FreeObject_extended_content_description( asf_object_t *p_obj)
 
     for( i = 0; i < p_ec->i_count; i++ )
     {
-        FREE( p_ec->ppsz_name[i] );
-        FREE( p_ec->ppsz_value[i] );
+        FREENULL( p_ec->ppsz_name[i] );
+        FREENULL( p_ec->ppsz_value[i] );
     }
 }
 
index 4a50ff6..162674f 100644 (file)
@@ -80,7 +80,6 @@ static int Seek            ( demux_t *, mtime_t, int );
 static int Demux_Seekable  ( demux_t * );
 static int Demux_UnSeekable( demux_t * );
 
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
 #define __ABS( x ) ( (x) < 0 ? (-(x)) : (x) )
 
 typedef struct
@@ -651,11 +650,11 @@ static void Close ( vlc_object_t * p_this )
     {
         if( p_sys->track[i] )
         {
-            FREE( p_sys->track[i]->p_index );
+            FREENULL( p_sys->track[i]->p_index );
             free( p_sys->track[i] );
         }
     }
-    FREE( p_sys->track );
+    FREENULL( p_sys->track );
     AVI_ChunkFreeRoot( p_demux->s, &p_sys->ck_root );
     vlc_meta_Delete( p_sys->meta );
 
index 5ee0ddf..89de164 100644 (file)
     } \
     return( i_code )
 
-#define FREE( p ) \
-    if( p ) {free( p ); p = NULL; }
-
-
 
 /* Some assumptions:
         * The input method HAVE to be seekable
@@ -376,7 +372,7 @@ static int MP4_ReadBox_ftyp( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_ftyp( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_ftyp->i_compatible_brands );
+    FREENULL( p_box->data.p_ftyp->i_compatible_brands );
 }
 
 
@@ -619,7 +615,7 @@ static int MP4_ReadBox_hdlr( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_hdlr( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_hdlr->psz_name );
+    FREENULL( p_box->data.p_hdlr->psz_name );
 }
 
 static int MP4_ReadBox_vmhd( stream_t *p_stream, MP4_Box_t *p_box )
@@ -708,7 +704,7 @@ static int MP4_ReadBox_url( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_url( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_url->psz_location )
+    FREENULL( p_box->data.p_url->psz_location )
 }
 
 static int MP4_ReadBox_urn( stream_t *p_stream, MP4_Box_t *p_box )
@@ -729,8 +725,8 @@ static int MP4_ReadBox_urn( stream_t *p_stream, MP4_Box_t *p_box )
 }
 static void MP4_FreeBox_urn( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_urn->psz_name );
-    FREE( p_box->data.p_urn->psz_location );
+    FREENULL( p_box->data.p_urn->psz_name );
+    FREENULL( p_box->data.p_urn->psz_location );
 }
 
 
@@ -783,8 +779,8 @@ static int MP4_ReadBox_stts( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stts( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_stts->i_sample_count );
-    FREE( p_box->data.p_stts->i_sample_delta );
+    FREENULL( p_box->data.p_stts->i_sample_count );
+    FREENULL( p_box->data.p_stts->i_sample_delta );
 }
 
 static int MP4_ReadBox_ctts( stream_t *p_stream, MP4_Box_t *p_box )
@@ -817,8 +813,8 @@ static int MP4_ReadBox_ctts( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_ctts( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_ctts->i_sample_count );
-    FREE( p_box->data.p_ctts->i_sample_offset );
+    FREENULL( p_box->data.p_ctts->i_sample_count );
+    FREENULL( p_box->data.p_ctts->i_sample_offset );
 }
 
 static int MP4_ReadLengthDescriptor( uint8_t **pp_peek, int64_t  *i_read )
@@ -941,12 +937,12 @@ static int MP4_ReadBox_esds( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_esds( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_esds->es_descriptor.psz_URL );
+    FREENULL( p_box->data.p_esds->es_descriptor.psz_URL );
     if( p_box->data.p_esds->es_descriptor.p_decConfigDescr )
     {
-        FREE( p_box->data.p_esds->es_descriptor.p_decConfigDescr->p_decoder_specific_info );
+        FREENULL( p_box->data.p_esds->es_descriptor.p_decConfigDescr->p_decoder_specific_info );
     }
-    FREE( p_box->data.p_esds->es_descriptor.p_decConfigDescr );
+    FREENULL( p_box->data.p_esds->es_descriptor.p_decConfigDescr );
 }
 
 static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1033,14 +1029,14 @@ static void MP4_FreeBox_avcC( MP4_Box_t *p_box )
 
     for( i = 0; i < p_avcC->i_sps; i++ )
     {
-        FREE( p_avcC->sps[i] );
+        FREENULL( p_avcC->sps[i] );
     }
     for( i = 0; i < p_avcC->i_pps; i++ )
     {
-        FREE( p_avcC->pps[i] );
+        FREENULL( p_avcC->pps[i] );
     }
-    if( p_avcC->i_sps > 0 ) FREE( p_avcC->sps );
-    if( p_avcC->i_pps > 0 ) FREE( p_avcC->pps );
+    if( p_avcC->i_sps > 0 ) FREENULL( p_avcC->sps );
+    if( p_avcC->i_pps > 0 ) FREENULL( p_avcC->pps );
 }
 
 static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1192,7 +1188,7 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_sample_soun( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_sample_soun->p_qt_description );
+    FREENULL( p_box->data.p_sample_soun->p_qt_description );
 
     if( p_box->i_type == FOURCC_drms )
     {
@@ -1271,7 +1267,7 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box )
 
 void MP4_FreeBox_sample_vide( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_sample_vide->p_qt_image_description );
+    FREENULL( p_box->data.p_sample_vide->p_qt_image_description );
 }
 
 static int MP4_ReadBox_sample_mp4s( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1368,7 +1364,7 @@ static int MP4_ReadBox_sample_tx3g( stream_t *p_stream, MP4_Box_t *p_box )
 /* We can't easily call it, and anyway ~ 20 bytes lost isn't a real problem */
 static void MP4_FreeBox_sample_text( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_sample_text->psz_text_name );
+    FREENULL( p_box->data.p_sample_text->psz_text_name );
 }
 #endif
 
@@ -1429,7 +1425,7 @@ static int MP4_ReadBox_stsz( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stsz( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_stsz->i_entry_size );
+    FREENULL( p_box->data.p_stsz->i_entry_size );
 }
 
 static int MP4_ReadBox_stsc( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1466,9 +1462,9 @@ static int MP4_ReadBox_stsc( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stsc( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_stsc->i_first_chunk );
-    FREE( p_box->data.p_stsc->i_samples_per_chunk );
-    FREE( p_box->data.p_stsc->i_sample_description_index );
+    FREENULL( p_box->data.p_stsc->i_first_chunk );
+    FREENULL( p_box->data.p_stsc->i_samples_per_chunk );
+    FREENULL( p_box->data.p_stsc->i_sample_description_index );
 }
 
 static int MP4_ReadBox_stco_co64( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1514,7 +1510,7 @@ static int MP4_ReadBox_stco_co64( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stco_co64( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_co64->i_chunk_offset );
+    FREENULL( p_box->data.p_co64->i_chunk_offset );
 }
 
 static int MP4_ReadBox_stss( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1548,7 +1544,7 @@ static int MP4_ReadBox_stss( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stss( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_stss->i_sample_number )
+    FREENULL( p_box->data.p_stss->i_sample_number )
 }
 
 static int MP4_ReadBox_stsh( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1585,8 +1581,8 @@ static int MP4_ReadBox_stsh( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stsh( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_stsh->i_shadowed_sample_number )
-    FREE( p_box->data.p_stsh->i_sync_sample_number )
+    FREENULL( p_box->data.p_stsh->i_shadowed_sample_number )
+    FREENULL( p_box->data.p_stsh->i_sync_sample_number )
 }
 
 
@@ -1617,7 +1613,7 @@ static int MP4_ReadBox_stdp( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_stdp( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_stdp->i_priority )
+    FREENULL( p_box->data.p_stdp->i_priority )
 }
 
 static int MP4_ReadBox_padb( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1661,10 +1657,10 @@ static int MP4_ReadBox_padb( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_padb( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_padb->i_reserved1 );
-    FREE( p_box->data.p_padb->i_pad2 );
-    FREE( p_box->data.p_padb->i_reserved2 );
-    FREE( p_box->data.p_padb->i_pad1 );
+    FREENULL( p_box->data.p_padb->i_reserved1 );
+    FREENULL( p_box->data.p_padb->i_pad2 );
+    FREENULL( p_box->data.p_padb->i_reserved2 );
+    FREENULL( p_box->data.p_padb->i_pad1 );
 }
 
 static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1720,10 +1716,10 @@ static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_elst( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_elst->i_segment_duration );
-    FREE( p_box->data.p_elst->i_media_time );
-    FREE( p_box->data.p_elst->i_media_rate_integer );
-    FREE( p_box->data.p_elst->i_media_rate_fraction );
+    FREENULL( p_box->data.p_elst->i_segment_duration );
+    FREENULL( p_box->data.p_elst->i_media_time );
+    FREENULL( p_box->data.p_elst->i_media_rate_integer );
+    FREENULL( p_box->data.p_elst->i_media_rate_fraction );
 }
 
 static int MP4_ReadBox_cprt( stream_t *p_stream, MP4_Box_t *p_box )
@@ -1757,7 +1753,7 @@ static int MP4_ReadBox_cprt( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_cprt( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_cprt->psz_notice );
+    FREENULL( p_box->data.p_cprt->psz_notice );
 }
 
 
@@ -1804,7 +1800,7 @@ static int MP4_ReadBox_cmvd( stream_t *p_stream, MP4_Box_t *p_box )
 }
 static void MP4_FreeBox_cmvd( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_cmvd->p_data );
+    FREENULL( p_box->data.p_cmvd->p_data );
 }
 
 
@@ -1967,7 +1963,7 @@ static int MP4_ReadBox_rdrf( stream_t *p_stream, MP4_Box_t *p_box )
 
 static void MP4_FreeBox_rdrf( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_rdrf->psz_ref )
+    FREENULL( p_box->data.p_rdrf->psz_ref )
 }
 
 
@@ -2105,7 +2101,7 @@ static int MP4_ReadBox_0xa9xxx( stream_t *p_stream, MP4_Box_t *p_box )
 }
 static void MP4_FreeBox_0xa9xxx( MP4_Box_t *p_box )
 {
-    FREE( p_box->data.p_0xa9xxx->psz_text );
+    FREENULL( p_box->data.p_0xa9xxx->psz_text );
 }
 
 /* For generic */
@@ -2606,7 +2602,7 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result,
 
     if( !psz_path || !psz_path[0] )
     {
-        FREE( psz_path );
+        FREENULL( psz_path );
         *pp_result = NULL;
         return;
     }
@@ -2623,7 +2619,7 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result,
 //                 psz_path,psz_token,i_number );
         if( !psz_token )
         {
-            FREE( psz_token );
+            FREENULL( psz_token );
             free( psz_fmt );
             *pp_result = p_box;
             return;
@@ -2712,7 +2708,7 @@ static void __MP4_BoxGet( MP4_Box_t **pp_result,
         else
         {
 //            fprintf( stderr, "Argg malformed token \"%s\"",psz_token );
-            FREE( psz_token );
+            FREENULL( psz_token );
             free( psz_fmt );
             *pp_result = NULL;
             return;
index 6ff246b..1dc2448 100644 (file)
@@ -245,8 +245,6 @@ static inline int64_t MP4_GetMoviePTS(demux_sys_t *p_sys )
 static vlc_bool_t FindItem( demux_t *p_demux, playlist_t *p_playlist,
                      playlist_item_t **pp_item );
 
-#define FREE( p ) if( p ) { free( p ); (p) = NULL;}
-
 /*****************************************************************************
  * Open: check file and initializes MP4 structures
  *****************************************************************************/
@@ -879,7 +877,7 @@ static void Close ( vlc_object_t * p_this )
     {
         MP4_TrackDestroy( p_demux, &p_sys->track[i_track] );
     }
-    FREE( p_sys->track );
+    FREENULL( p_sys->track );
 
     free( p_sys );
 }
@@ -1904,18 +1902,18 @@ static void MP4_TrackDestroy( demux_t *p_demux, mp4_track_t *p_track )
     {
         if( p_track->chunk )
         {
-           FREE(p_track->chunk[i_chunk].p_sample_count_dts);
-           FREE(p_track->chunk[i_chunk].p_sample_delta_dts );
+           FREENULL(p_track->chunk[i_chunk].p_sample_count_dts);
+           FREENULL(p_track->chunk[i_chunk].p_sample_delta_dts );
 
-           FREE(p_track->chunk[i_chunk].p_sample_count_pts);
-           FREE(p_track->chunk[i_chunk].p_sample_offset_pts );
+           FREENULL(p_track->chunk[i_chunk].p_sample_count_pts);
+           FREENULL(p_track->chunk[i_chunk].p_sample_offset_pts );
         }
     }
-    FREE( p_track->chunk );
+    FREENULL( p_track->chunk );
 
     if( !p_track->i_sample_size )
     {
-        FREE( p_track->p_sample_size );
+        FREENULL( p_track->p_sample_size );
     }
 }
 
index f8a6a50..680ebf8 100644 (file)
@@ -37,8 +37,6 @@
 #include "playlist.h"
 #include "vlc_meta.h"
 
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
-
 struct demux_sys_t
 {
     char    *psz_prefix;
@@ -373,12 +371,12 @@ static int Demux( demux_t *p_demux )
                     continue;
                 }
                 /* cleanup entry */
-                FREE( psz_title_entry )
-                FREE( psz_base_entry )
-                FREE( psz_author_entry )
-                FREE( psz_copyright_entry )
-                FREE( psz_moreinfo_entry )
-                FREE( psz_abstract_entry )
+                FREENULL( psz_title_entry )
+                FREENULL( psz_base_entry )
+                FREENULL( psz_author_entry )
+                FREENULL( psz_copyright_entry )
+                FREENULL( psz_moreinfo_entry )
+                FREENULL( psz_abstract_entry )
                 b_entry = VLC_FALSE;
             }
             else if( !strncasecmp( psz_parse, "<Entry>", 7 ) )
@@ -419,7 +417,7 @@ static int Demux( demux_t *p_demux )
                             /* create the new entry */
                             asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current->p_input->psz_name ) );
                             p_entry = input_ItemNew( p_playlist, psz_string, psz_name );
-                            FREE( psz_name );
+                            FREENULL( psz_name );
                             
                             vlc_input_item_CopyOptions( p_current->p_input, p_entry );
                             p_entry->p_meta = vlc_meta_New();
@@ -452,12 +450,12 @@ static int Demux( demux_t *p_demux )
                 if( psz_moreinfo_asx ) vlc_meta_SetURL( p_current->p_input->p_meta, psz_moreinfo_asx );
                 if( psz_abstract_asx ) vlc_meta_SetDescription( p_current->p_input->p_meta, psz_abstract_asx );
                 vlc_mutex_unlock( &p_current->p_input->lock );
-                FREE( psz_base_asx );
-                FREE( psz_title_asx );
-                FREE( psz_author_asx );
-                FREE( psz_copyright_asx );
-                FREE( psz_moreinfo_asx );
-                FREE( psz_abstract_asx );
+                FREENULL( psz_base_asx );
+                FREENULL( psz_title_asx );
+                FREENULL( psz_author_asx );
+                FREENULL( psz_copyright_asx );
+                FREENULL( psz_moreinfo_asx );
+                FREENULL( psz_abstract_asx );
                 psz_parse++;
             }
             else psz_parse++;
index e975bb0..591f5ad 100644 (file)
@@ -269,14 +269,12 @@ static int Demux( demux_t *p_demux )
                          p_item_in_category, (i_parent_id > 0 ) ? VLC_TRUE:
                                                  VLC_FALSE, PLAYLIST_APPEND );
 
-#define FREE(a) if( a ) free( a ); a = NULL;
-                    FREE( psz_name );
-                    FREE( psz_mrl );
-                    FREE( psz_genre );
-                    FREE( psz_bitrate );
-                    FREE( psz_listeners );
-                    FREE( psz_now );
-#undef FREE
+                    FREENULL( psz_name );
+                    FREENULL( psz_mrl );
+                    FREENULL( psz_genre );
+                    FREENULL( psz_bitrate );
+                    FREENULL( psz_listeners );
+                    FREENULL( psz_now );
                 }
                 free( psz_elname );
                 psz_elname = strdup("");
index f92a62b..2d906da 100644 (file)
@@ -113,8 +113,6 @@ void E_(Close_QTL)( vlc_object_t *p_this )
     free( p_sys );
 }
 
-#define FREE( a ) if( a ) free( a );
-
 static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
index da6385b..36986aa 100644 (file)
@@ -174,7 +174,6 @@ static int DemuxGenre( demux_t *p_demux )
     char *psz_eltname = NULL; /* tag name */
     input_item_t *p_input;
 
-#define FREE(a) if( a ) free( a ); a = NULL;
     while( xml_ReaderRead( p_sys->p_xml_reader ) == 1 )
     {
         int i_type;
@@ -203,8 +202,8 @@ static int DemuxGenre( demux_t *p_demux )
                             xml_ReaderValue( p_sys->p_xml_reader );
                         if( !psz_attrname || !psz_attrvalue )
                         {
-                            FREE(psz_attrname);
-                            FREE(psz_attrvalue);
+                            FREENULL(psz_attrname);
+                            FREENULL(psz_attrvalue);
                             free(psz_eltname);
                             /*FIXME: isn't return a bit too much. what about break*/
                             return -1;
@@ -247,9 +246,9 @@ static int DemuxGenre( demux_t *p_demux )
                              p_sys->p_current, p_sys->p_item_in_category,
                              (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
                              PLAYLIST_APPEND );
-                    FREE( psz_name );
+                    FREENULL( psz_name );
                 }
-                FREE( psz_eltname );
+                FREENULL( psz_eltname );
                 break;
         }
     }
@@ -331,8 +330,8 @@ static int DemuxStation( demux_t *p_demux )
                         if( !psz_attrname || !psz_attrvalue )
                         {
                             free(psz_eltname);
-                            FREE(psz_attrname);
-                            FREE(psz_attrvalue);
+                            FREENULL(psz_attrname);
+                            FREENULL(psz_attrvalue);
                             return -1;
                         }
 
@@ -357,8 +356,8 @@ static int DemuxStation( demux_t *p_demux )
                         if( !psz_attrname || !psz_attrvalue )
                         {
                             free(psz_eltname);
-                            FREE(psz_attrname);
-                            FREE(psz_attrvalue);
+                            FREENULL(psz_attrname);
+                            FREENULL(psz_attrvalue);
                             return -1;
                         }
 
@@ -441,14 +440,14 @@ static int DemuxStation( demux_t *p_demux )
                              (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
                              PLAYLIST_APPEND );
 
-                    FREE( psz_name );
-                    FREE( psz_mt )
-                    FREE( psz_id )
-                    FREE( psz_br )
-                    FREE( psz_genre )
-                    FREE( psz_ct )
-                    FREE( psz_lc )
-                    FREE( psz_rt )
+                    FREENULL( psz_name );
+                    FREENULL( psz_mt )
+                    FREENULL( psz_id )
+                    FREENULL( psz_br )
+                    FREENULL( psz_genre )
+                    FREENULL( psz_ct )
+                    FREENULL( psz_lc )
+                    FREENULL( psz_rt )
                 }
                 free( psz_eltname );
                 break;
@@ -456,7 +455,6 @@ static int DemuxStation( demux_t *p_demux )
     }
     return 0;
 }
-#undef FREE
 
 static int Control( demux_t *p_demux, int i_query, va_list args )
 {
index f446061..0e29263 100644 (file)
@@ -28,8 +28,6 @@
 
 #include <wx/statline.h>
 
-#define FREE( i ) { if( i ) free( i ); i = NULL; }
-
 /*****************************************************************************
  * Event Table.
  *****************************************************************************/
@@ -236,8 +234,8 @@ void InteractionDialog::OnClear( wxCommandEvent& event )
     for( i = p_dialog->i_widgets - 1 ; i >= 0 ; i-- )
     {
         user_widget_t *p_widget = p_dialog->pp_widgets[i];
-        FREE( p_widget->psz_text );
-        FREE( p_widget->val.psz_string );
+        FREENULL( p_widget->psz_text );
+        FREENULL( p_widget->val.psz_string );
         REMOVE_ELEM( p_dialog->pp_widgets, p_dialog->i_widgets, i );
         free( p_widget );
     }
@@ -271,5 +269,3 @@ void InteractionDialog::Finish( int i_ret )
     p_dialog->i_return = i_ret;
     vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
 }
-
-#undef FREE
index ab101ec..e4221dc 100644 (file)
@@ -72,7 +72,6 @@ static block_t *OggCreateFooter( sout_mux_t *, mtime_t );
 /*****************************************************************************
  * Misc declarations
  *****************************************************************************/
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
 
 /* Structures used for OggDS headers used in ogm files */
 
@@ -263,10 +262,10 @@ static void Close( vlc_object_t * p_this )
         {
             i_dts = p_sys->pp_del_streams[i]->i_dts;
             ogg_stream_clear( &p_sys->pp_del_streams[i]->os );
-            FREE( p_sys->pp_del_streams[i]->p_oggds_header );
-            FREE( p_sys->pp_del_streams[i] );
+            FREENULL( p_sys->pp_del_streams[i]->p_oggds_header );
+            FREENULL( p_sys->pp_del_streams[i] );
         }
-        FREE( p_sys->pp_del_streams );
+        FREENULL( p_sys->pp_del_streams );
         p_sys->i_streams -= p_sys->i_del_streams;
 
         /* Write footer */
@@ -387,7 +386,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             break;
 
         default:
-            FREE( p_input->p_sys );
+            FREENULL( p_input->p_sys );
             return VLC_EGENERIC;
         }
         break;
@@ -411,7 +410,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             fourcc_to_wf_tag( p_stream->i_fourcc, &i_tag );
             if( i_tag == WAVE_FORMAT_UNKNOWN )
             {
-                FREE( p_input->p_sys );
+                FREENULL( p_input->p_sys );
                 return VLC_EGENERIC;
             }
 
@@ -465,12 +464,12 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             break;
 
         default:
-            FREE( p_input->p_sys );
+            FREENULL( p_input->p_sys );
             return VLC_EGENERIC;
         }
         break;
     default:
-        FREE( p_input->p_sys );
+        FREENULL( p_input->p_sys );
         return VLC_EGENERIC;
     }
 
@@ -518,8 +517,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
         else
         {
             /* wasn't already added so get rid of it */
-            FREE( p_stream->p_oggds_header );
-            FREE( p_stream );
+            FREENULL( p_stream->p_oggds_header );
+            FREENULL( p_stream );
             p_sys->i_add_streams--;
         }
     }
@@ -890,10 +889,10 @@ static int Mux( sout_mux_t *p_mux )
             /* Remove deleted logical streams */
             for( i = 0; i < p_sys->i_del_streams; i++ )
             {
-                FREE( p_sys->pp_del_streams[i]->p_oggds_header );
-                FREE( p_sys->pp_del_streams[i] );
+                FREENULL( p_sys->pp_del_streams[i]->p_oggds_header );
+                FREENULL( p_sys->pp_del_streams[i] );
             }
-            FREE( p_sys->pp_del_streams );
+            FREENULL( p_sys->pp_del_streams );
             p_sys->i_streams = 0;
         }
 
index 6560376..228b9ab 100644 (file)
@@ -272,9 +272,6 @@ struct demux_sys_t
 #endif
     static void FreeSDP( sdp_t *p_sdp );
 
-
-#define FREE( p ) \
-    if( p ) { free( p ); (p) = NULL; }
 /*****************************************************************************
  * Open: initialize and create stuff
  *****************************************************************************/
@@ -411,11 +408,11 @@ static int OpenDemux( vlc_object_t *p_this )
     p_demux->pf_control = Control;
     p_demux->pf_demux = Demux;
 
-    FREE( psz_sdp );
+    FREENULL( psz_sdp );
     return VLC_SUCCESS;
 
 error:
-    FREE( psz_sdp );
+    FREENULL( psz_sdp );
     if( p_sdp ) FreeSDP( p_sdp ); p_sdp = NULL;
     stream_Seek( p_demux->s, 0 );
     return VLC_EGENERIC;
@@ -435,7 +432,7 @@ static void Close( vlc_object_t *p_this )
     {
         net_Close( p_sys->pi_fd[i] );
     }
-    FREE( p_sys->pi_fd );
+    FREENULL( p_sys->pi_fd );
 
 #if 0
     if( config_GetInt( p_sd, "sap-cache" ) )
@@ -448,7 +445,7 @@ static void Close( vlc_object_t *p_this )
     {
         RemoveAnnounce( p_sd, p_sys->pp_announces[i] );
     }
-    FREE( p_sys->pp_announces );
+    FREENULL( p_sys->pp_announces );
 
     if( p_sys->p_playlist )
     {
@@ -593,9 +590,9 @@ static int Demux( demux_t *p_demux )
     p_parent_input = p_input->input.p_item;
 
     vlc_mutex_lock( &p_parent_input->lock );
-    FREE( p_parent_input->psz_uri );
+    FREENULL( p_parent_input->psz_uri );
     p_parent_input->psz_uri = strdup( p_sdp->psz_uri );
-    FREE( p_parent_input->psz_name );
+    FREENULL( p_parent_input->psz_name );
     p_parent_input->psz_name = strdup( EnsureUTF8( p_sdp->psz_sessionname ) );
     p_parent_input->i_type = ITEM_TYPE_NET;
 
@@ -802,7 +799,7 @@ static int ParseSAP( services_discovery_t *p_sd, uint8_t *p_buffer, int i_read )
 
     CreateAnnounce( p_sd, i_hash, p_sdp );
 
-    FREE( p_decompressed_buffer );
+    FREENULL( p_decompressed_buffer );
     return VLC_SUCCESS;
 }
 
@@ -993,7 +990,7 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
                 strncmp( psz_parse, "video", 5 ) )
             {
                 msg_Warn( p_obj, "unhandled media type -%s-", psz_parse );
-                FREE( psz_uri );
+                FREENULL( psz_uri );
                 return VLC_EGENERIC;
             }
 
@@ -1002,7 +999,7 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
         else
         {
             msg_Warn( p_obj, "unable to parse m field (1)");
-            FREE( psz_uri );
+            FREENULL( psz_uri );
             return VLC_EGENERIC;
         }
 
@@ -1025,7 +1022,7 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
         else
         {
             msg_Warn( p_obj, "unable to parse m field (2)");
-            FREE( psz_uri );
+            FREENULL( psz_uri );
             return VLC_EGENERIC;
         }
 
@@ -1075,8 +1072,8 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
     asprintf( &p_sdp->psz_uri, "%s://%s@%s:%i", psz_proto, psz_source,
               psz_uri, i_port );
 
-    FREE( psz_uri );
-    FREE( psz_proto );
+    FREENULL( psz_uri );
+    FREENULL( psz_proto );
     return VLC_SUCCESS;
 }
 
@@ -1200,10 +1197,10 @@ static sdp_t *  ParseSDP( vlc_object_t *p_obj, char* psz_sdp )
 
                 p_sdp->i_session_id = atoll( psz_sess_id );
 
-                FREE( psz_sess_id );
+                FREENULL( psz_sess_id );
 
                 GET_FIELD( psz_sess_id );
-                FREE( psz_sess_id );
+                FREENULL( psz_sess_id );
 
                 GET_FIELD( p_sdp->psz_network_type );
                 GET_FIELD( p_sdp->psz_address_type );
@@ -1347,26 +1344,26 @@ static int Decompress( unsigned char *psz_src, unsigned char **_dst, int i_len )
 static void FreeSDP( sdp_t *p_sdp )
 {
     int i;
-    FREE( p_sdp->psz_sdp );
-    FREE( p_sdp->psz_sessionname );
-    FREE( p_sdp->psz_connection );
-    FREE( p_sdp->psz_media );
-    FREE( p_sdp->psz_uri );
-    FREE( p_sdp->psz_username );
-    FREE( p_sdp->psz_network_type );
+    FREENULL( p_sdp->psz_sdp );
+    FREENULL( p_sdp->psz_sessionname );
+    FREENULL( p_sdp->psz_connection );
+    FREENULL( p_sdp->psz_media );
+    FREENULL( p_sdp->psz_uri );
+    FREENULL( p_sdp->psz_username );
+    FREENULL( p_sdp->psz_network_type );
 
-    FREE( p_sdp->psz_address );
-    FREE( p_sdp->psz_address_type );
+    FREENULL( p_sdp->psz_address );
+    FREENULL( p_sdp->psz_address_type );
 
     for( i= p_sdp->i_attributes - 1; i >= 0 ; i-- )
     {
         struct attribute_t *p_attr = p_sdp->pp_attributes[i];
-        FREE( p_sdp->pp_attributes[i]->psz_field );
-        FREE( p_sdp->pp_attributes[i]->psz_value );
+        FREENULL( p_sdp->pp_attributes[i]->psz_field );
+        FREENULL( p_sdp->pp_attributes[i]->psz_value );
         REMOVE_ELEM( p_sdp->pp_attributes, p_sdp->i_attributes, i);
-        FREE( p_attr );
+        FREENULL( p_attr );
     }
-    FREE( p_sdp );
+    FREENULL( p_sdp );
 }
 
 static int RemoveAnnounce( services_discovery_t *p_sd,
index 92ead51..b385d49 100644 (file)
@@ -102,8 +102,6 @@ vlc_module_begin();
     set_callbacks( Open, Close );
 vlc_module_end();
 
-
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
 /*****************************************************************************
  * Exported prototypes
  *****************************************************************************/
index a4c0f51..79b6f55 100644 (file)
@@ -257,15 +257,14 @@ void __LoadLogoList( vlc_object_t *p_this, logo_list_t *p_logo_list )
 /*****************************************************************************
  * FreeLogoList
  *****************************************************************************/
-#define FREE( a ) free(a);a=NULL;
 void FreeLogoList( logo_list_t *p_logo_list )
 {
     unsigned int i;
-    if( p_logo_list->psz_filename ) FREE( p_logo_list->psz_filename );
+    FREENULL( p_logo_list->psz_filename );
     for( i = 0; i < p_logo_list->i_count; i++ )
     {
         logo_t *p_logo = &p_logo_list->p_logo[i];
-        if( p_logo[i].psz_file ) FREE( p_logo[i].psz_file );
+        FREENULL( p_logo[i].psz_file );
         if( p_logo[i].p_pic )
         {
             p_logo[i].p_pic->pf_release( p_logo[i].p_pic );
@@ -273,7 +272,6 @@ void FreeLogoList( logo_list_t *p_logo_list )
         }
     }
 }
-#undef FREE
 
 /*****************************************************************************
  * vout_sys_t: logo video output method descriptor
index 0eb3767..159570f 100644 (file)
@@ -118,8 +118,6 @@ struct vout_sys_t
     image_handler_t *p_image;
 };
 
-#define FREE( p ) if( p ) { free( p ); p = NULL; }
-
 /*****************************************************************************
  * Create: allocates video thread
  *****************************************************************************
@@ -152,8 +150,8 @@ static int Create( vlc_object_t *p_this )
     if( !p_vout->p_sys->p_image )
     {
         msg_Err( p_this, "unable to create image handler") ;
-        FREE( p_vout->p_sys->psz_prefix );
-        FREE( p_vout->p_sys );
+        FREENULL( p_vout->p_sys->psz_prefix );
+        FREENULL( p_vout->p_sys );
         return VLC_EGENERIC;
     }
 
@@ -239,9 +237,9 @@ static void Destroy( vlc_object_t *p_this )
 
     /* Destroy structure */
     image_HandlerDelete( p_vout->p_sys->p_image );
-    FREE( p_vout->p_sys->psz_prefix );
-    FREE( p_vout->p_sys->psz_format );
-    FREE( p_vout->p_sys );
+    FREENULL( p_vout->p_sys->psz_prefix );
+    FREENULL( p_vout->p_sys->psz_format );
+    FREENULL( p_vout->p_sys );
 }
 
 /*****************************************************************************
index f5798cc..acc6259 100644 (file)
@@ -45,9 +45,6 @@
 #include <vlc_vod.h>
 #include <charset.h>
 
-#define FREE( p ) \
-        if( p ) { free( p ); (p) = NULL; }
-
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -158,11 +155,11 @@ void vlm_Delete( vlm_t *p_vlm )
     vlc_mutex_destroy( &p_vlm->lock );
 
     while( p_vlm->i_media ) vlm_MediaDelete( p_vlm, p_vlm->media[0], NULL );
-    FREE( p_vlm->media );
+    FREENULL( p_vlm->media );
 
     while( p_vlm->i_schedule ) vlm_ScheduleDelete( p_vlm,
                                                    p_vlm->schedule[0], NULL );
-    FREE( p_vlm->schedule );
+    FREENULL( p_vlm->schedule );
 
     vlc_object_detach( p_vlm );
     vlc_object_destroy( p_vlm );
@@ -833,8 +830,8 @@ static int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
     }
 
 success:
-    for( i = 0 ; i < i_command ; i++ ) FREE( ppsz_command[i] );
-    FREE( ppsz_command );
+    for( i = 0 ; i < i_command ; i++ ) FREENULL( ppsz_command[i] );
+    FREENULL( ppsz_command );
     *pp_message = p_message;
 
     return VLC_SUCCESS;
@@ -843,8 +840,8 @@ syntax_error:
     p_message = vlm_MessageNew( ppsz_command[0], "Wrong command syntax" );
 
 error:
-    for( i = 0 ; i < i_command ; i++ ) FREE( ppsz_command[i] );
-    FREE( ppsz_command );
+    for( i = 0 ; i < i_command ; i++ ) FREENULL( ppsz_command[i] );
+    FREENULL( ppsz_command );
     *pp_message = p_message;
 
     return VLC_EGENERIC;
index c4d73be..4e31148 100644 (file)
 #include <vlc/vlc.h>
 #include <vlc/sout.h>
 
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
-
-
 /****************************************************************************
  * Sout-side functions
  ****************************************************************************/
@@ -183,10 +177,10 @@ void sout_AnnounceSessionDestroy( session_descriptor_t *p_session )
 {
     if( p_session )
     {
-        FREE( p_session->psz_name );
-        FREE( p_session->psz_group );
-        FREE( p_session->psz_uri );
-        FREE( p_session->psz_sdp );
+        FREENULL( p_session->psz_name );
+        FREENULL( p_session->psz_group );
+        FREENULL( p_session->psz_uri );
+        FREENULL( p_session->psz_sdp );
         free( p_session );
     }
 }
index 5a5f653..58f72ef 100644 (file)
@@ -88,8 +88,6 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
 static int announce_SAPAnnounceDel( sap_handler_t *p_sap,
                              session_descriptor_t *p_session );
 
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
-
 
 /**
  * Create the SAP handler
@@ -146,17 +144,17 @@ void announce_SAPHandlerDestroy( sap_handler_t *p_sap )
     for( i = 0 ; i< p_sap->i_sessions ; i++)
     {
         sap_session_t *p_session = p_sap->pp_sessions[i];
-        FREE( p_session->psz_sdp );
-        FREE( p_session->psz_data );
+        FREENULL( p_session->psz_sdp );
+        FREENULL( p_session->psz_data );
         REMOVE_ELEM( p_sap->pp_sessions, p_sap->i_sessions , i );
-        FREE( p_session );
+        FREENULL( p_session );
     }
 
     /* Free the remaining addresses */
     for( i = 0 ; i< p_sap->i_addresses ; i++)
     {
         sap_address_t *p_address = p_sap->pp_addresses[i];
-        FREE( p_address->psz_address );
+        FREENULL( p_address->psz_address );
         if( p_address->i_rfd > -1 )
         {
             net_Close( p_address->i_rfd );
@@ -166,7 +164,7 @@ void announce_SAPHandlerDestroy( sap_handler_t *p_sap )
             net_Close( p_address->i_wfd );
         }
         REMOVE_ELEM( p_sap->pp_addresses, p_sap->i_addresses, i );
-        FREE( p_address );
+        FREENULL( p_address );
     }
 
     /* Free the structure */
@@ -526,8 +524,8 @@ static int announce_SAPAnnounceDel( sap_handler_t *p_sap,
                          p_sap->i_sessions,
                          i );
 
-            FREE( p_session->p_sap->psz_sdp );
-            FREE( p_session->p_sap->psz_data );
+            FREENULL( p_session->p_sap->psz_sdp );
+            FREENULL( p_session->p_sap->psz_data );
             free( p_session->p_sap );
             break;
         }
index 496f74d..507cc3e 100644 (file)
@@ -63,8 +63,6 @@ static int  mrl_Parse( mrl_t *p_mrl, char *psz_mrl );
 /* mrl_Clean: clean p_mrl  after a call to mrl_Parse */
 static void mrl_Clean( mrl_t *p_mrl );
 
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
-
 /*****************************************************************************
  * sout_NewInstance: creates a new stream output instance
  *****************************************************************************/
@@ -147,8 +145,8 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
     {
         msg_Err( p_sout, "stream chain failed for `%s'", p_sout->psz_chain );
 
-        FREE( p_sout->psz_sout );
-        FREE( p_sout->psz_chain );
+        FREENULL( p_sout->psz_sout );
+        FREENULL( p_sout->psz_chain );
 
         vlc_object_detach( p_sout );
         vlc_object_destroy( p_sout );
@@ -170,8 +168,8 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
     sout_StreamDelete( p_sout->p_stream );
 
     /* *** free all string *** */
-    FREE( p_sout->psz_sout );
-    FREE( p_sout->psz_chain );
+    FREENULL( p_sout->psz_sout );
+    FREENULL( p_sout->psz_chain );
 
     /* delete meta */
     if( p_sout->p_meta )
@@ -426,7 +424,7 @@ sout_mux_t * sout_MuxNew( sout_instance_t *p_sout, char *psz_mux,
 
     if( p_mux->p_module == NULL )
     {
-        FREE( p_mux->psz_mux );
+        FREENULL( p_mux->psz_mux );
 
         vlc_object_detach( p_mux );
         vlc_object_destroy( p_mux );
@@ -723,9 +721,9 @@ static int mrl_Parse( mrl_t *p_mrl, char *psz_mrl )
 /* mrl_Clean: clean p_mrl  after a call to mrl_Parse */
 static void mrl_Clean( mrl_t *p_mrl )
 {
-    FREE( p_mrl->psz_access );
-    FREE( p_mrl->psz_way );
-    FREE( p_mrl->psz_name );
+    FREENULL( p_mrl->psz_access );
+    FREENULL( p_mrl->psz_way );
+    FREENULL( p_mrl->psz_name );
 }
 
 
@@ -923,8 +921,8 @@ static void sout_CfgDestroy( sout_cfg_t *p_cfg )
 
         p_next = p_cfg->p_next;
 
-        FREE( p_cfg->psz_name );
-        FREE( p_cfg->psz_value );
+        FREENULL( p_cfg->psz_name );
+        FREENULL( p_cfg->psz_value );
         free( p_cfg );
 
         p_cfg = p_next;
@@ -1143,8 +1141,8 @@ void sout_StreamDelete( sout_stream_t *p_stream )
     vlc_object_detach( p_stream );
     if( p_stream->p_module ) module_Unneed( p_stream, p_stream->p_module );
 
-    FREE( p_stream->psz_name );
-    FREE( p_stream->psz_next );
+    FREENULL( p_stream->psz_name );
+    FREENULL( p_stream->psz_next );
 
     sout_CfgDestroy( p_stream->p_cfg );