[vlc-commits] text_style: fix text_segment_Copy

Francois Cartegnie git at videolan.org
Thu Sep 10 14:03:49 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep 10 14:01:11 2015 +0200| [ea7b1992038af096eb02b1790584eadad10a3dd9] | committer: Francois Cartegnie

text_style: fix text_segment_Copy

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ea7b1992038af096eb02b1790584eadad10a3dd9
---

 src/misc/text_style.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/misc/text_style.c b/src/misc/text_style.c
index a52273d..9a5ed2e 100644
--- a/src/misc/text_style.c
+++ b/src/misc/text_style.c
@@ -207,15 +207,21 @@ text_segment_t *text_segment_Copy( text_segment_t *p_src )
     text_segment_t *p_dst = NULL, *p_dst0 = NULL;
 
     while( p_src ) {
-        text_segment_t *p_next = text_segment_New( p_src->psz_text );
-        if( p_next )
-            p_next->style = text_style_Duplicate( p_src->style );
-        p_src = p_src->p_next;
+        text_segment_t *p_new = text_segment_New( p_src->psz_text );
+        if( p_new )
+            p_new->style = text_style_Duplicate( p_src->style );
 
         if( p_dst == NULL )
-            p_dst = p_dst0 = p_next;
+        {
+            p_dst = p_dst0 = p_new;
+        }
         else
-            p_dst->p_next = p_next;
+        {
+            p_dst->p_next = p_new;
+            p_dst = p_dst->p_next;
+        }
+
+        p_src = p_src->p_next;
     }
 
     return p_dst0;



More information about the vlc-commits mailing list