Commit f83fdcac authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Expansion safety

parent a14e5a4e
......@@ -48,7 +48,7 @@ static inline void *realloc_down( void *ptr, size_t size )
#define INSERT_ELEM( p_ar, i_oldsize, i_pos, elem ) \
do \
{ \
if( !i_oldsize ) (p_ar) = NULL; \
if( !(i_oldsize) ) (p_ar) = NULL; \
(p_ar) = VLCCVP realloc( p_ar, ((i_oldsize) + 1) * sizeof(*(p_ar)) ); \
if( !(p_ar) ) abort(); \
if( (i_oldsize) - (i_pos) ) \
......@@ -56,7 +56,7 @@ static inline void *realloc_down( void *ptr, size_t size )
memmove( (p_ar) + (i_pos) + 1, (p_ar) + (i_pos), \
((i_oldsize) - (i_pos)) * sizeof( *(p_ar) ) ); \
} \
(p_ar)[i_pos] = elem; \
(p_ar)[(i_pos)] = elem; \
(i_oldsize)++; \
} \
while( 0 )
......
Markdown is supported
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