[vlc-commits] Fix sizeof mismatch (fix many cids)

Rémi Duraffort git at videolan.org
Mon Jul 22 18:14:57 CEST 2013


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Jul 22 17:42:52 2013 +0200| [aa1868c759f9f52ffd46596f63c528cf1bfa3e26] | committer: Rémi Duraffort

Fix sizeof mismatch (fix many cids)

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

 include/vlc_arrays.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
index 7749140..91f5405 100644
--- a/include/vlc_arrays.h
+++ b/include/vlc_arrays.h
@@ -92,9 +92,9 @@ static inline void *realloc_down( void *ptr, size_t size )
 #define TAB_APPEND_CAST( cast, count, tab, p )             \
   do {                                          \
     if( (count) > 0 )                           \
-        (tab) = cast realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \
+        (tab) = cast realloc( tab, sizeof( *(tab) ) * ( (count) + 1 ) ); \
     else                                        \
-        (tab) = cast malloc( sizeof( void ** ) );    \
+        (tab) = cast malloc( sizeof( *(tab) ) );    \
     if( !(tab) ) abort();                       \
     (tab)[count] = (p);                         \
     (count)++;                                  \
@@ -123,7 +123,7 @@ static inline void *realloc_down( void *ptr, size_t size )
             {                                   \
                 memmove( ((void**)(tab) + i_index),    \
                          ((void**)(tab) + i_index+1),  \
-                         ( (count) - i_index - 1 ) * sizeof( void* ) );\
+                         ( (count) - i_index - 1 ) * sizeof( *(tab) ) );\
             }                                   \
             (count)--;                          \
             if( (count) == 0 )                  \
@@ -136,9 +136,9 @@ static inline void *realloc_down( void *ptr, size_t size )
 
 #define TAB_INSERT_CAST( cast, count, tab, p, index ) do { \
     if( (count) > 0 )                           \
-        (tab) = cast realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \
+        (tab) = cast realloc( tab, sizeof( *(tab) ) * ( (count) + 1 ) ); \
     else                                        \
-        (tab) = cast malloc( sizeof( void ** ) );       \
+        (tab) = cast malloc( sizeof( *(tab) ) );       \
     if( !(tab) ) abort();                       \
     if( (count) - (index) > 0 )                 \
         memmove( (void**)(tab) + (index) + 1,   \



More information about the vlc-commits mailing list