]> git.sesse.net Git - vlc/commitdiff
Added a c++ compatible TAB_APPEND_CPP
authorLaurent Aimar <fenrir@videolan.org>
Fri, 23 Mar 2007 19:49:21 +0000 (19:49 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 23 Mar 2007 19:49:21 +0000 (19:49 +0000)
include/vlc_arrays.h
include/vlc_vlm.h

index f9634984dd19bbf565152b2086719a0c5a09f163..11a8de8fa6c93baf0196c38c9715a2567361684c 100644 (file)
     (tab)= NULL;                                \
   } while(0)
 
-#define TAB_APPEND( count, tab, p )             \
+#define TAB_APPEND_CAST( cast, count, tab, p )             \
   do {                                          \
     if( (count) > 0 )                           \
-        (tab) = realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \
+        (tab) = cast realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \
     else                                        \
-        (tab) = malloc( sizeof( void ** ) );    \
+        (tab) = cast malloc( sizeof( void ** ) );    \
     (tab)[count] = (p);                         \
     (count)++;                                  \
   } while(0)
 
+#define TAB_APPEND( count, tab, p )             \
+    TAB_APPEND_CAST( , count, tab, p )
+#define TAB_APPEND_CPP( type, count, tab, p )   \
+    TAB_APPEND_CAST( (type**), count, tab, p )
+
 #define TAB_FIND( count, tab, p, index )        \
   do {                                          \
         int _i_;                                \
index e1bffe57e82dc1ec1a7c12cdbb07f83d5e91263c..1ca38d50952c7603ded55fb21b847a39b9fda3f5 100644 (file)
@@ -187,9 +187,9 @@ static inline void vlm_media_Copy( vlm_media_t *p_dst, vlm_media_t *p_src )
         p_dst->psz_name = strdup( p_src->psz_name );
 
     for( i = 0; i < p_src->i_input; i++ )
-        TAB_APPEND( p_dst->i_input, p_dst->ppsz_input, strdup(p_src->ppsz_input[i]) );
+        TAB_APPEND_CPP( char, p_dst->i_input, p_dst->ppsz_input, strdup(p_src->ppsz_input[i]) );
     for( i = 0; i < p_src->i_option; i++ )
-        TAB_APPEND( p_dst->i_option, p_dst->ppsz_option, strdup(p_src->ppsz_option[i]) );
+        TAB_APPEND_CPP( char, p_dst->i_option, p_dst->ppsz_option, strdup(p_src->ppsz_option[i]) );
 
     if( p_src->psz_output )
         p_dst->psz_output = strdup( p_src->psz_output );