Commit 28b7dd1a authored by Laurent Aimar's avatar Laurent Aimar
Browse files

Added a c++ compatible TAB_APPEND_CPP

parent 7934d7aa
...@@ -86,16 +86,21 @@ ...@@ -86,16 +86,21 @@
(tab)= NULL; \ (tab)= NULL; \
} while(0) } while(0)
#define TAB_APPEND( count, tab, p ) \ #define TAB_APPEND_CAST( cast, count, tab, p ) \
do { \ do { \
if( (count) > 0 ) \ if( (count) > 0 ) \
(tab) = realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \ (tab) = cast realloc( tab, sizeof( void ** ) * ( (count) + 1 ) ); \
else \ else \
(tab) = malloc( sizeof( void ** ) ); \ (tab) = cast malloc( sizeof( void ** ) ); \
(tab)[count] = (p); \ (tab)[count] = (p); \
(count)++; \ (count)++; \
} while(0) } 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 ) \ #define TAB_FIND( count, tab, p, index ) \
do { \ do { \
int _i_; \ int _i_; \
......
...@@ -187,9 +187,9 @@ static inline void vlm_media_Copy( vlm_media_t *p_dst, vlm_media_t *p_src ) ...@@ -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 ); p_dst->psz_name = strdup( p_src->psz_name );
for( i = 0; i < p_src->i_input; i++ ) 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++ ) 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 ) if( p_src->psz_output )
p_dst->psz_output = strdup( p_src->psz_output ); p_dst->psz_output = strdup( p_src->psz_output );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment