]> git.sesse.net Git - vlc/commitdiff
Use calloc.
authorRémi Duraffort <ivoire@videolan.org>
Wed, 10 Feb 2010 08:02:57 +0000 (09:02 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 10 Feb 2010 08:05:11 +0000 (09:05 +0100)
modules/codec/zvbi.c
modules/demux/mp4/mp4.c
modules/misc/svg.c
modules/video_filter/chain.c

index 50c4edf7d26437f7c574e9829e37b0db50e237f1..2efa7bc4b29e3a98691ee9c175b2aeeb29e77b43 100644 (file)
@@ -206,10 +206,9 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     p_dec->pf_decode_sub = Decode;
-    p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
+    p_sys = p_dec->p_sys = calloc( 1, sizeof(decoder_sys_t) );
     if( p_sys == NULL )
         return VLC_ENOMEM;
-    memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     p_sys->i_key[0] = p_sys->i_key[1] = p_sys->i_key[2] = '*' - '0';
     p_sys->b_update = false;
@@ -246,8 +245,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Create the var on vlc_global. */
     p_sys->i_wanted_page = var_CreateGetInteger( p_dec, "vbi-page" );
-    var_AddCallback( p_dec, "vbi-page",
-                     RequestPage, p_sys );
+    var_AddCallback( p_dec, "vbi-page", RequestPage, p_sys );
 
     /* Check if the Teletext track has a known "initial page". */
     if( p_sys->i_wanted_page == 100 && p_dec->fmt_in.subs.teletext.i_magazine != -1 )
index f2140d26b3291ee014c0430cc494a14b8cde4231..9561c817770f5b058059f5931c42cce07f1ed658 100644 (file)
@@ -313,8 +313,7 @@ static int Open( vlc_object_t * p_this )
     p_demux->pf_control = Control;
 
     /* create our structure that will contains all data */
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
+    p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
 
     /* Now load all boxes ( except raw data ) */
     if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL )
index 31e3f1e6e09c9ce1ee3a7dbd8396c9ae45a5f54e..7c5ad64b8912b575280e0413673cea83d72c4e09 100644 (file)
@@ -195,14 +195,13 @@ static char *svg_GetTemplate( vlc_object_t *p_this )
                 msg_Dbg( p_this, "reading %ld bytes from template %s",
                          (unsigned long)s.st_size, psz_filename );
 
-                psz_template = malloc( s.st_size + 42 );
+                psz_template = calloc( 1, s.st_size + 42 );
                 if( !psz_template )
                 {
                     fclose( file );
                     free( psz_filename );
                     return NULL;
                 }
-                memset( psz_template, 0, s.st_size + 1 );
                 if(! fread( psz_template, s.st_size, 1, file ) )
                 {
                     msg_Dbg( p_this, "No data read from template." );
@@ -469,13 +468,12 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
         int length;
         char* psz_template = p_sys->psz_template;
         length = strlen( psz_string ) + strlen( psz_template ) + 42;
-        p_svg->psz_text = malloc( length + 1 );
+        p_svg->psz_text = calloc( 1, length + 1 );
         if( !p_svg->psz_text )
         {
             free( p_svg );
             return VLC_ENOMEM;
         }
-        memset( p_svg->psz_text, 0, length + 1 );
         snprintf( p_svg->psz_text, length, psz_template, psz_string );
     }
     p_svg->i_width = p_sys->i_width;
index bd7549d12b3be662e158d5a304afd55f2358982c..6642dd0539ca21dbe41d6218853380328f34d0ce 100644 (file)
@@ -91,12 +91,10 @@ static int Activate( vlc_object_t *p_this )
     if( !b_chroma && !b_resize )
         return VLC_EGENERIC;
 
-    p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
+    p_sys = p_filter->p_sys = calloc( 1, sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_ENOMEM;
 
-    memset( p_sys, 0, sizeof( *p_sys ) );
-
     p_sys->p_chain = filter_chain_New( p_filter, "video filter2", false, BufferAllocationInit, NULL, p_filter );
     if( !p_sys->p_chain )
     {