[vlc-devel] commit: calloc( nb_elmnt, size ) instead of calloc( size, nb_elmnt ) ( Rémi Duraffort )

git version control git at videolan.org
Fri Jan 16 11:53:58 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jan 16 11:53:20 2009 +0100| [91bf0f045482a9455dbe1409e9ed79245c44a52c] | committer: Rémi Duraffort 

calloc( nb_elmnt, size ) instead of calloc( size, nb_elmnt )

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91bf0f045482a9455dbe1409e9ed79245c44a52c
---

 modules/access/pvr.c               |    4 ++--
 modules/codec/quicktime.c          |    2 +-
 modules/demux/avi/avi.c            |    2 +-
 modules/demux/avi/libavi.c         |    6 +++---
 modules/misc/notify/growl.m        |    2 +-
 modules/video_output/opengllayer.m |    2 +-
 src/misc/objects.c                 |    2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/access/pvr.c b/modules/access/pvr.c
index 737b73f..291a82f 100644
--- a/modules/access/pvr.c
+++ b/modules/access/pvr.c
@@ -433,8 +433,8 @@ static int ConfigureV4L2( access_t * p_access )
     controls.reserved[0] = 0;
     controls.reserved[1] = 0;
     controls.count       = 0;
-    controls.controls    = calloc( sizeof( struct v4l2_ext_control ),
-                                   MAX_V4L2_CTRLS );
+    controls.controls    = calloc( MAX_V4L2_CTRLS,
+                                   sizeof( struct v4l2_ext_control ) );
 
     if( controls.controls == NULL )
         return VLC_ENOMEM;
diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c
index 508d116..b9ef7ae 100644
--- a/modules/codec/quicktime.c
+++ b/modules/codec/quicktime.c
@@ -397,7 +397,7 @@ static int OpenAudio( decoder_t *p_dec )
     /* get lock, avoid segfault */
     vlc_mutex_lock( &qt_mutex );
 
-    p_sys = calloc( sizeof( decoder_sys_t ), 1 );
+    p_sys = calloc( 1, sizeof( decoder_sys_t ) );
     p_dec->p_sys = p_sys;
     p_dec->pf_decode_audio = DecodeAudio;
 
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 3321cdf..7d398e8 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -584,7 +584,7 @@ static int Open( vlc_object_t * p_this )
                     {
                         const uint8_t *p_pal = fmt.p_extra;
 
-                        fmt.video.p_palette = calloc( sizeof(video_palette_t), 1 );
+                        fmt.video.p_palette = calloc( 1, sizeof(video_palette_t) );
                         fmt.video.p_palette->i_entries = __MIN(fmt.i_extra/4, 256);
 
                         for( int i = 0; i < fmt.video.p_palette->i_entries; i++ )
diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index 2f03219..ad65ecb 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -513,7 +513,7 @@ static int AVI_ChunkRead_indx( stream_t *s, avi_chunk_t *p_chk )
 
         i_count = __MIN( p_indx->i_entriesinuse, i_read / 8 );
         p_indx->i_entriesinuse = i_count;
-        p_indx->idx.std = calloc( sizeof( indx_std_entry_t ), i_count );
+        p_indx->idx.std = calloc( i_count, sizeof( indx_std_entry_t ) );
 
         for( i = 0; i < i_count; i++ )
         {
@@ -528,7 +528,7 @@ static int AVI_ChunkRead_indx( stream_t *s, avi_chunk_t *p_chk )
 
         i_count = __MIN( p_indx->i_entriesinuse, i_read / 12 );
         p_indx->i_entriesinuse = i_count;
-        p_indx->idx.field = calloc( sizeof( indx_field_entry_t ), i_count );
+        p_indx->idx.field = calloc( i_count, sizeof( indx_field_entry_t ) );
         for( i = 0; i < i_count; i++ )
         {
             AVI_READ4BYTES( p_indx->idx.field[i].i_offset );
@@ -545,7 +545,7 @@ static int AVI_ChunkRead_indx( stream_t *s, avi_chunk_t *p_chk )
 
         i_count = __MIN( p_indx->i_entriesinuse, i_read / 16 );
         p_indx->i_entriesinuse = i_count;
-        p_indx->idx.super = calloc( sizeof( indx_super_entry_t ), i_count );
+        p_indx->idx.super = calloc( i_count, sizeof( indx_super_entry_t ) );
 
         for( i = 0; i < i_count; i++ )
         {
diff --git a/modules/misc/notify/growl.m b/modules/misc/notify/growl.m
index 157ceee..32abcb5 100644
--- a/modules/misc/notify/growl.m
+++ b/modules/misc/notify/growl.m
@@ -106,7 +106,7 @@ static int Open( vlc_object_t *p_this )
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
     intf_sys_t    *p_sys;
 
-    p_sys = p_intf->p_sys = calloc( sizeof(intf_sys_t), 1);
+    p_sys = p_intf->p_sys = calloc( 1, sizeof(intf_sys_t) );
     if( !p_sys )
         return VLC_ENOMEM;
 
diff --git a/modules/video_output/opengllayer.m b/modules/video_output/opengllayer.m
index b59f6bb..8536cd0 100644
--- a/modules/video_output/opengllayer.m
+++ b/modules/video_output/opengllayer.m
@@ -140,7 +140,7 @@ static int CreateVout( vlc_object_t *p_this )
     char * psz;
 
     /* Allocate structure */
-    p_vout->p_sys = p_sys = calloc( sizeof( vout_sys_t ), 1 );
+    p_vout->p_sys = p_sys = calloc( 1, sizeof( vout_sys_t ) );
     if( p_sys == NULL )
         return VLC_EGENERIC;
 
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 36aeb76..5f90d99 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -141,7 +141,7 @@ void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size,
         p_new->i_flags = p_this->i_flags
             & (OBJECT_FLAGS_NODBG|OBJECT_FLAGS_QUIET|OBJECT_FLAGS_NOINTERACT);
 
-    p_priv->p_vars = calloc( sizeof( variable_t ), 16 );
+    p_priv->p_vars = calloc( 16, sizeof( variable_t ) );
 
     if( !p_priv->p_vars )
     {




More information about the vlc-devel mailing list