[vlc-commits] Add text_segment_Delete to delete a specific segment
Hugo Beauzée-Luyssen
git at videolan.org
Tue Jul 28 16:01:57 CEST 2015
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Jul 8 11:07:35 2015 +0200| [c1d3fe80b2248c7cf56cd1aa0ab5a776c7c678d8] | committer: Jean-Baptiste Kempf
Add text_segment_Delete to delete a specific segment
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1d3fe80b2248c7cf56cd1aa0ab5a776c7c678d8
---
include/vlc_text_style.h | 9 ++++++++-
src/libvlccore.sym | 1 +
src/misc/text_style.c | 14 +++++++++++---
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/include/vlc_text_style.h b/include/vlc_text_style.h
index 2993faf..6d9280e 100644
--- a/include/vlc_text_style.h
+++ b/include/vlc_text_style.h
@@ -133,13 +133,20 @@ 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.
*
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index a2975d7..3749a5b 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -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
diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index 1788634..8e7e8a2 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -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;
}
More information about the vlc-commits
mailing list