[vlc-devel] [PATCH 02/11] playlist/item: playlist_NodeAddCopy: minor cleaning

Filip Roséen filip at atch.se
Thu May 18 12:01:09 CEST 2017


---
 src/playlist/item.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/playlist/item.c b/src/playlist/item.c
index 2b932daf31..fe8b87ad49 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -534,29 +534,28 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
  *              parent's children
  * \return the position in parent item just behind the last new item inserted
  */
-int playlist_NodeAddCopy (
-    playlist_t *p_playlist, playlist_item_t *p_item,
+int playlist_NodeAddCopy( playlist_t *p_playlist, playlist_item_t *p_item,
     playlist_item_t *p_parent, int i_pos )
 {
     PL_ASSERT_LOCKED;
     assert( p_parent != NULL && p_item != NULL );
     assert( p_parent->i_children > -1 );
 
-    if( i_pos == PLAYLIST_END ) i_pos = p_parent->i_children;
+    if( i_pos == PLAYLIST_END )
+        i_pos = p_parent->i_children;
 
     bool b_flat = false;
 
-    playlist_item_t *p_up = p_parent;
-    while( p_up )
+    for( playlist_item_t* p_up = p_parent; p_up; p_up = p_up->p_parent )
     {
-        if( p_up == p_playlist->p_playing )
-            if( !pl_priv(p_playlist)->b_tree ) b_flat = true;
+        if( p_up == p_playlist->p_playing && !pl_priv(p_playlist)->b_tree )
+            b_flat = true;
+
         if( p_up == p_item )
             /* TODO: We don't support copying a node into itself (yet),
             because we insert items as we copy. Instead, we should copy
             all items first and then insert. */
             return i_pos;
-        p_up = p_up->p_parent;
     }
 
     return RecursiveInsertCopy( p_playlist, p_item, p_parent, i_pos, b_flat );
-- 
2.12.2


More information about the vlc-devel mailing list