]> git.sesse.net Git - vlc/commitdiff
Use calloc when applicable (decoders).
authorLaurent Aimar <fenrir@videolan.org>
Sat, 14 Feb 2009 18:45:50 +0000 (19:45 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 14 Feb 2009 23:22:15 +0000 (00:22 +0100)
modules/codec/faad.c
modules/codec/fake.c
modules/codec/flac.c
modules/codec/kate.c
modules/codec/realaudio.c
modules/codec/theora.c
modules/codec/vorbis.c

index fd5636efbf8a4109d8510952f420aa0c2835c5fe..022106dad5b59fb4e15c6b4c451cacae2b50a40c 100644 (file)
@@ -123,8 +123,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) ) ) == NULL )
         return VLC_ENOMEM;
 
     /* Open a faad context */
index d47a9146c10e9d3f4f94938325a379579f40fb37..0696eb1b8d5b2571d8a10d86b3cb32aa6da5b129 100644 (file)
@@ -143,12 +143,9 @@ static int OpenDecoder( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    p_dec->p_sys = (decoder_sys_t *)malloc( sizeof( decoder_sys_t ) );
+    p_dec->p_sys = calloc( 1, sizeof( *p_dec->p_sys ) );
     if( !p_dec->p_sys )
-    {
         return VLC_ENOMEM;
-    }
-    memset( p_dec->p_sys, 0, sizeof( decoder_sys_t ) );
 
     psz_file = var_CreateGetNonEmptyStringCommand( p_dec, "fake-file" );
     if( !psz_file )
index 6206360bbeaecef25c770acf7a2fd64ca118ca85..157d9e808c799557b677cb0a680b428b979673cd 100644 (file)
@@ -214,8 +214,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = malloc(sizeof(*p_sys)) ) == NULL )
         return VLC_ENOMEM;
 
     /* Misc init */
index 6af25e4d25a7a2f613e59af2ecc2d81d81df0495..a6d8ef4156f315111baeccd42811453277dfa0b8 100644 (file)
@@ -360,8 +360,7 @@ static int OpenDecoder( vlc_object_t *p_this )
         DecodeBlock;
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = malloc(sizeof(*p_sys)) ) == NULL )
         return VLC_ENOMEM;
 
     vlc_mutex_init( &p_sys->lock );
@@ -426,8 +425,10 @@ static int OpenDecoder( vlc_object_t *p_this )
 
 #endif
 
+    es_format_Init( &p_dec->fmt_out, SPU_ES, 0 );
+
     /* add the decoder to the global list */
-    decoder_t **list = ( decoder_t** ) realloc( kate_decoder_list, (kate_decoder_list_size+1) * sizeof( decoder_t* ));
+    decoder_t **list = realloc( kate_decoder_list, (kate_decoder_list_size+1) * sizeof( *list ));
     if( list )
     {
         list[ kate_decoder_list_size++ ] = p_dec;
index 1945f2aa76c0567f30761159dc066b8bd1113a86..aa1d1334c31874f3c758be3d6e31b4d1dcdf0c51 100644 (file)
@@ -200,10 +200,9 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    p_dec->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_ENOMEM;
-    memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     /* Flavor for SIPR codecs */
     p_sys->i_codec_flavor = -1;
index c0d70be94b96c6d625eca9deb8a01c4e257971fc..a7c6eafcc870c187099c014b9fb6271f44b46479 100644 (file)
@@ -139,8 +139,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = malloc(sizeof(*p_sys)) ) == NULL )
         return VLC_ENOMEM;
     p_dec->p_sys->b_packetizer = false;
 
index 33e8a7d0ded7d65888efaec7e5b32d30144be4b5..5d25be9d51b09abfd8c74d80738499710c0c7a2b 100644 (file)
@@ -235,8 +235,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
 
     /* Allocate the memory needed to store the decoder's structure */
-    if( ( p_dec->p_sys = p_sys =
-          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+    if( ( p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) ) ) == NULL )
         return VLC_ENOMEM;
 
     /* Misc init */