[vlc-devel] [RFC 32/38] demux/real: removed usage of xcalloc

Filip Roséen filip at videolabs.io
Mon Jun 27 13:43:43 CEST 2016


---
 modules/demux/real.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/real.c b/modules/demux/real.c
index 4ba4494..210d58d 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -980,7 +980,7 @@ static char *StreamReadString2( stream_t *s )
     if( i_length <= 0 )
         return NULL;
 
-    char *psz_string = xcalloc( 1, i_length + 1 );
+    char *psz_string = calloc( 1, i_length + 1 );
 
     stream_Read( s, psz_string, i_length ); /* Valid even if !psz_string */
 
@@ -1680,22 +1680,22 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
         tk->i_subpackets =
             i_subpacket_h * i_frame_size / tk->i_subpacket_size;
         tk->p_subpackets =
-            xcalloc( tk->i_subpackets, sizeof(block_t *) );
+            calloc( tk->i_subpackets, sizeof(block_t *) );
         tk->p_subpackets_timecode =
-            xcalloc( tk->i_subpackets , sizeof( int64_t ) );
+            calloc( tk->i_subpackets , sizeof( int64_t ) );
     }
     else if( fmt.i_codec == VLC_CODEC_RA_288 )
     {
         tk->i_subpackets =
             i_subpacket_h * i_frame_size / tk->i_coded_frame_size;
         tk->p_subpackets =
-            xcalloc( tk->i_subpackets, sizeof(block_t *) );
+            calloc( tk->i_subpackets, sizeof(block_t *) );
         tk->p_subpackets_timecode =
-            xcalloc( tk->i_subpackets , sizeof( int64_t ) );
+            calloc( tk->i_subpackets , sizeof( int64_t ) );
     }
 
     /* Check if the calloc went correctly */
-    if( tk->i_subpacket > 0 && ( !tk->p_subpackets || !tk->p_subpackets_timecode ) )
+    if( unlikely( tk->i_subpacket > 0 && ( !tk->p_subpackets || !tk->p_subpackets_timecode ) ) )
     {
         free( tk->p_subpackets_timecode );
         free( tk->p_subpackets );
-- 
2.9.0



More information about the vlc-devel mailing list