Commit d4dc8ab0 authored by Tristan Matthews's avatar Tristan Matthews

hds: drop macro

Fixes cid #1228697 from commit 16040129
parent 2131a8a8
......@@ -1009,9 +1009,6 @@ static void maintain_live_chunks(
hds_stream->chunks_head = chunk;
}
#define SAFE_STRDUP( dest, src, ret ) \
if( !( (dest) = strdup( (src) ) ) ) \
return (ret)
static void* live_thread( void* p )
{
......@@ -1032,7 +1029,8 @@ static void* live_thread( void* p )
if( hds_stream->abst_url &&
( isFQUrl( hds_stream->abst_url ) ) )
{
SAFE_STRDUP( abst_url, hds_stream->abst_url, NULL );
if( !( abst_url = strdup( hds_stream->abst_url ) ) )
return NULL;
}
else
{
......@@ -1152,9 +1150,11 @@ static int parse_Manifest( stream_t *s )
{
case XML_READER_STARTELEM:
if( current_element_idx == 0 && element_stack[current_element_idx] == 0 ) {
SAFE_STRDUP( element_stack[current_element_idx], node, VLC_ENOMEM );
if( !( element_stack[current_element_idx] = strdup( node ) ) )
return VLC_ENOMEM;
} else {
SAFE_STRDUP( element_stack[++current_element_idx], node, VLC_ENOMEM );
if ( !( element_stack[++current_element_idx] = strdup( node ) ) )
return VLC_ENOMEM;
}
break;
......@@ -1190,15 +1190,18 @@ static int parse_Manifest( stream_t *s )
{
if( !strcmp(attr_name, "streamId" ) )
{
SAFE_STRDUP( medias[media_idx].stream_id, attr_value, VLC_ENOMEM );
if( !( medias[media_idx].stream_id = strdup( attr_value ) ) )
return VLC_ENOMEM;
}
if( !strcmp(attr_name, "url" ) )
{
SAFE_STRDUP( medias[media_idx].media_url, attr_value, VLC_ENOMEM );
if( !( medias[media_idx].media_url = strdup( attr_value ) ) )
return VLC_ENOMEM;
}
if( !strcmp(attr_name, "bootstrapInfoId" ) )
{
SAFE_STRDUP( medias[media_idx].bootstrap_id, attr_value, VLC_ENOMEM );
if( !( medias[media_idx].bootstrap_id = strdup( attr_value ) ) )
return VLC_ENOMEM;
}
}
......@@ -1211,15 +1214,18 @@ static int parse_Manifest( stream_t *s )
{
if( !strcmp(attr_name, "url" ) )
{
SAFE_STRDUP( bootstraps[bootstrap_idx].url, attr_value, VLC_ENOMEM );
if( !( bootstraps[bootstrap_idx].url = strdup( attr_value ) ) )
return VLC_ENOMEM;
}
if( !strcmp(attr_name, "id" ) )
{
SAFE_STRDUP( bootstraps[bootstrap_idx].id, attr_value, VLC_ENOMEM );
if( !( bootstraps[bootstrap_idx].id = strdup( attr_value ) ) )
return VLC_ENOMEM;
}
if( !strcmp(attr_name, "profile" ) )
{
SAFE_STRDUP( bootstraps[bootstrap_idx].profile, attr_value, VLC_ENOMEM );
if( !( bootstraps[bootstrap_idx].profile = strdup( attr_value ) ) )
return VLC_ENOMEM;
}
}
}
......@@ -1250,7 +1256,8 @@ static int parse_Manifest( stream_t *s )
if( current_element &&
! strcmp( element_stack[current_element_idx-1], "manifest" ) )
{
SAFE_STRDUP( media_id, node, VLC_ENOMEM );
if( !( media_id = strdup( node ) ) )
return VLC_ENOMEM;
}
}
}
......@@ -1285,7 +1292,11 @@ static int parse_Manifest( stream_t *s )
if( medias[i].media_url )
{
SAFE_STRDUP( new_stream->url, medias[i].media_url, VLC_ENOMEM );
if( !(new_stream->url = strdup( medias[i].media_url ) ) )
{
free(new_stream);
return VLC_ENOMEM;
}
}
if( ! sys->live )
......@@ -1312,7 +1323,11 @@ static int parse_Manifest( stream_t *s )
}
else
{
SAFE_STRDUP( new_stream->abst_url, bootstraps[j].url, VLC_ENOMEM );
if( !(new_stream->abst_url = strdup( bootstraps[j].url ) ) )
{
free(new_stream);
return VLC_ENOMEM;
}
}
vlc_array_append( sys->hds_streams, new_stream );
......@@ -1345,7 +1360,6 @@ static int parse_Manifest( stream_t *s )
return VLC_SUCCESS;
}
#undef SAFE_STRDUP
static void hds_free( hds_stream_t *p_stream )
{
......
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