Commit c1d3fe80 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

Add text_segment_Delete to delete a specific segment

parent ef4a8698
......@@ -133,12 +133,19 @@ VLC_API void text_style_Delete( text_style_t * );
* This function will create a new text segment.
*
* You should use text_segment_ChainDelete to destroy it, to clean all
* the linked segments.
* the linked segments, or text_segment_Delete to free a specic one
*
* This duplicates the string passed as argument
*/
VLC_API text_segment_t *text_segment_New( const char * );
/**
* Delete a text segment and its content.
*
* This assumes the segment is not part of a chain
*/
VLC_API void text_segment_Delete( text_segment_t * );
/**
* This function will destroy a list of text segments allocated
* by text_segment_New.
......
......@@ -419,6 +419,7 @@ subpicture_region_Copy
subpicture_region_Delete
subpicture_region_New
text_segment_New
text_segment_Delete
text_segment_ChainDelete
text_segment_Copy
vlc_tls_ClientCreate
......
......@@ -105,15 +105,23 @@ text_segment_t *text_segment_New( const char *psz_text )
return segment;
}
void text_segment_Delete( text_segment_t* segment )
{
if ( segment != NULL )
{
free( segment->psz_text );
free( segment );
text_style_Delete( segment->style );
}
}
void text_segment_ChainDelete( text_segment_t *segment )
{
while( segment != NULL )
{
text_segment_t *p_next = segment->p_next;
free( segment->psz_text );
//text_style_Delete( segment->style );
free( segment );
text_segment_Delete( segment );
segment = p_next;
}
......
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