**************************************************************************/
static inline void libvlc_media_list_path_append( libvlc_media_list_path_t * p_path, int index )
{
- libvlc_media_list_path_t *p_tmp;
int old_deepness = libvlc_media_list_path_deepness( *p_path );
- *p_tmp = realloc( *p_path, sizeof(int)*(old_deepness+2));
- if( *p_tmp )
- {
- *p_tmp = *p_path;
- *p_path[old_deepness] = index;
- *p_path[old_deepness+1] = -1;
- }
+ *p_path = realloc( *p_path, sizeof(int)*(old_deepness+2));
+ *p_path[old_deepness] = index;
+ *p_path[old_deepness+1] = -1;
}
/**************************************************************************
|| i_read == 0 )
break;
*pi_data += i_read;
- char *p_tmp = realloc( *pp_data, *pi_data + 1025 );
- if( p_tmp )
- *pp_data = p_tmp;
+ *pp_data = realloc( *pp_data, *pi_data + 1025 );
}
while ( !p_object->b_die
if( p_fmt->i_extra )
{
- void *p_tmp;
- p_tmp = realloc( es->fmt.p_extra, p_fmt->i_extra );
- if( p_tmp )
- {
- es->fmt.i_extra = p_fmt->i_extra;
- es->fmt.p_extra = p_tmp;
- memcpy( es->fmt.p_extra, p_fmt->p_extra, p_fmt->i_extra );
- }
+ es->fmt.i_extra = p_fmt->i_extra;
+ es->fmt.p_extra = realloc( es->fmt.p_extra, p_fmt->i_extra );
+ memcpy( es->fmt.p_extra, p_fmt->p_extra, p_fmt->i_extra );
+
if( !es->p_dec )
return VLC_SUCCESS;
#if 1
EsCreateDecoder( out, es );
#else
- p_tmp = realloc( es->p_dec->fmt_in.p_extra, p_fmt->i_extra );
- if( p_tmp )
- {
- es->p_dec->fmt_in.i_extra = p_fmt->i_extra;
- es->p_dec->fmt_in.p_extra = p_tmp;
- memcpy( es->p_dec->fmt_in.p_extra,
- p_fmt->p_extra, p_fmt->i_extra );
- }
+ es->p_dec->fmt_in.i_extra = p_fmt->i_extra;
+ es->p_dec->fmt_in.p_extra =
+ realloc( es->p_dec->fmt_in.p_extra, p_fmt->i_extra );
+ memcpy( es->p_dec->fmt_in.p_extra,
+ p_fmt->p_extra, p_fmt->i_extra );
#endif
}
int i_new, input_attachment_t **pp_new )
{
int i_attachment = *pi_attachment;
- input_attachment_t **attachment;
+ input_attachment_t **attachment = *ppp_attachment;
int i;
- attachment = realloc( *ppp_attachment,
+ attachment = realloc( attachment,
sizeof(input_attachment_t**) * ( i_attachment + i_new ) );
- if( attachment )
- {
- for( i = 0; i < i_new; i++ )
- attachment[i_attachment++] = pp_new[i];
- free( pp_new );
+ for( i = 0; i < i_new; i++ )
+ attachment[i_attachment++] = pp_new[i];
+ free( pp_new );
- /* */
- *pi_attachment = i_attachment;
- *ppp_attachment = attachment;
- }
+ /* */
+ *pi_attachment = i_attachment;
+ *ppp_attachment = attachment;
}
-
/*****************************************************************************
* InputGetExtraFiles
* Autodetect extra input list
/* We need to create a local copy */
if( p_sys->i_peek < i_read )
{
- uint8_t *p_tmp;
- p_tmp = realloc( p_sys->p_peek, i_read );
- if( !p_tmp )
+ p_sys->p_peek = realloc( p_sys->p_peek, i_read );
+ if( !p_sys->p_peek )
{
p_sys->i_peek = 0;
return 0;
}
- p_sys->p_peek = p_tmp;
p_sys->i_peek = i_read;
}
if( p_sys->i_peek < i_read )
{
- uint8_t *p_tmp;
- p_tmp = realloc( p_sys->p_peek, i_read );
- if( !p_tmp )
+ p_sys->p_peek = realloc( p_sys->p_peek, i_read );
+ if( !p_sys->p_peek )
{
p_sys->i_peek = 0;
return 0;
}
p_sys->i_peek = i_read;
- p_sys->p_peek = p_tmp;
}
memcpy( p_sys->p_peek, &tk->p_buffer[i_off],
if( psz_eol )
{
- char *p_tmp;
i_data = (psz_eol - (char *)p_data) + 1;
- p_tmp = realloc( p_line, i_line + i_data + s->p_text->i_char_width ); /* add \0 */
- if( !p_tmp )
+ p_line = realloc( p_line, i_line + i_data + s->p_text->i_char_width ); /* add \0 */
+ if( !p_line )
goto error;
- p_line = p_tmp;
i_data = stream_Read( s, &p_line[i_line], i_data );
if( i_data <= 0 ) break; /* Hmmm */
i_line += i_data - s->p_text->i_char_width; /* skip \n */;
}
/* Read data (+1 for easy \0 append) */
- char *p_tmp;
- p_tmp = realloc( p_line, i_line + STREAM_PROBE_LINE + s->p_text->i_char_width );
- if( !p_tmp )
+ p_line = realloc( p_line, i_line + STREAM_PROBE_LINE + s->p_text->i_char_width );
+ if( !p_line )
goto error;
- p_line = p_tmp;
i_data = stream_Read( s, &p_line[i_line], STREAM_PROBE_LINE );
if( i_data <= 0 ) break; /* Hmmm */
i_line += i_data;
psz_line = strdup( ppsz_property[i] );
for( j = i+1; j < i_property; j++ )
{
- char *psz_tmp;
- psz_tmp = realloc( psz_line, strlen(psz_line) + strlen(ppsz_property[j]) + 1 + 1 );
- if( !psz_tmp )
- break;
- psz_line = psz_tmp;
+ psz_line = realloc( psz_line, strlen(psz_line) + strlen(ppsz_property[j]) + 1 + 1 );
strcat( psz_line, " " );
strcat( psz_line, ppsz_property[j] );
}
if ((confsize & 0xf) == 0)
{
- tab = realloc (module->p_config, (confsize + 17) * sizeof (*tab));
+ tab = realloc (tab, (confsize + 17) * sizeof (*tab));
if (tab == NULL)
return NULL;
return 0;
/* Add entry to cache */
- module_cache_t *p_tmp;
- p_tmp = realloc( p_bank->pp_cache, (p_bank->i_cache + 1) * sizeof(void *) );
- if( !p_tmp )
- return -1;
- *p_bank->pp_cache = p_tmp;
+ p_bank->pp_cache =
+ realloc( p_bank->pp_cache, (p_bank->i_cache + 1) * sizeof(void *) );
p_bank->pp_cache[p_bank->i_cache] = malloc( sizeof(module_cache_t) );
if( !p_bank->pp_cache[p_bank->i_cache] )
return -1;
i_size = p_acl->i_size;
p_ent = (vlc_acl_entry_t *)realloc( p_acl->p_entries,
- (p_acl->i_size+1) * sizeof( *p_ent ) );
+ ++p_acl->i_size * sizeof( *p_ent ) );
if( p_ent == NULL )
return -1;
- p_acl->i_size++;
p_acl->p_entries = p_ent;
p_ent += i_size;
if( p != NULL )
{
- httpd_message_t *p_msg;
p[4] = '\0';
- p_msg = realloc( answer->p_body, strlen((char*)answer->p_body) + 1 );
- if( p_msg )
- {
- answer->i_body = strlen((char*)answer->p_body) + 1;
- answer->p_body = p_msg;
- }
+ answer->i_body = strlen((char*)answer->p_body) + 1;
+ answer->p_body = realloc( answer->p_body, answer->i_body );
}
}
{
if( i_line == i_max )
{
- char *psz_tmp;
i_max += 1024;
- psz_tmp = realloc( psz_line, i_max );
- if( !psz_tmp )
- {
- free( psz_line );
- return NULL;
- }
- psz_line = psz_tmp;
+ psz_line = realloc( psz_line, i_max );
ptr = psz_line + i_line;
}
int i_data = 0;
for( ;; )
{
- uint8_t *p_tmp;
int i_read = 65536;
if( i_data >= INT_MAX - i_read )
break;
- p_tmp = realloc( p_data, i_data + i_read );
- if( !p_tmp )
+ p_data = realloc( p_data, i_data + i_read );
+ if( !p_data )
break;
- p_data = p_tmp;
i_read = stream_Read( p_stream, &p_data[i_data], i_read );
if( i_read <= 0 )
break;
#define INSERT_STRING( string ) \
if( string != NULL ) \
{ \
- char *tmp; \
int len = strlen( string ); \
- tmp = realloc( dst, i_size = i_size + len );\
- if( tmp ) \
- { \
- dst = tmp; \
- memcpy( (dst+d), string, len ); \
- d += len; \
- free( string ); \
- } \
+ dst = realloc( dst, i_size = i_size + len );\
+ memcpy( (dst+d), string, len ); \
+ d += len; \
+ free( string ); \
} \
else if( !b_empty_if_na ) \
{ \
/* same than INSERT_STRING, except that string won't be freed */
#define INSERT_STRING_NO_FREE( string ) \
{ \
- char *tmp; \
int len = strlen( string ); \
- tmp = realloc( dst, i_size = i_size + len );\
- if( tmp ) \
- { \
- dst = tmp; \
- memcpy( dst+d, string, len ); \
- d += len; \
- } \
+ dst = realloc( dst, i_size = i_size + len );\
+ memcpy( dst+d, string, len ); \
+ d += len; \
}
char *__str_format_meta( vlc_object_t *p_object, const char *string )
{