[vlc-commits] playlist: make PLAYLIST_END equal minus one
Rémi Denis-Courmont
git at videolan.org
Tue Nov 15 23:09:58 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 15 23:29:45 2016 +0200| [dcc131f2ada6733a11517cda5f805b581f2b6da0] | committer: Rémi Denis-Courmont
playlist: make PLAYLIST_END equal minus one
And simplify accordingly, notably inline playlist_NodeAppend().
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dcc131f2ada6733a11517cda5f805b581f2b6da0
---
include/vlc_playlist.h | 2 +-
src/playlist/item.c | 6 +-----
src/playlist/playlist_internal.h | 1 -
src/playlist/tree.c | 19 +------------------
4 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 05296b3..ed88bb3 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -225,7 +225,7 @@ enum
#define PLAYLIST_SPREPARSE 0x0010
#define PLAYLIST_NO_REBUILD 0x0020
-#define PLAYLIST_END -666
+#define PLAYLIST_END -1
enum pl_locked_state
{
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 6bd3655..cef6d86 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -822,11 +822,7 @@ static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
ARRAY_APPEND(p_playlist->items, p_item);
ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
- if( i_pos == PLAYLIST_END )
- playlist_NodeAppend( p_playlist, p_item, p_node );
- else
- playlist_NodeInsert( p_playlist, p_item, p_node, i_pos );
-
+ playlist_NodeInsert( p_playlist, p_item, p_node, i_pos );
playlist_SendAddNotify( p_playlist, p_item->i_id, p_node->i_id,
!( i_mode & PLAYLIST_NO_REBUILD ) );
}
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index 560db99..0861330 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -127,7 +127,6 @@ int playlist_InsertInputItemTree ( playlist_t *,
playlist_item_t *, input_item_node_t *, int, bool );
/* Tree walking */
-int playlist_NodeAppend(playlist_t *, playlist_item_t*, playlist_item_t *);
int playlist_NodeInsert(playlist_t *, playlist_item_t*, playlist_item_t *,
int);
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 82e5b755..45c45b7 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -80,8 +80,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
if( p_parent != NULL )
- playlist_NodeInsert( p_playlist, p_item, p_parent,
- i_pos == PLAYLIST_END ? -1 : i_pos );
+ playlist_NodeInsert( p_playlist, p_item, p_parent, i_pos );
playlist_SendAddNotify( p_playlist, p_item->i_id,
p_parent ? p_parent->i_id : -1,
!( i_flags & PLAYLIST_NO_REBUILD ));
@@ -194,22 +193,6 @@ void playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
playlist_ItemRelease( p_root );
}
-
-/**
- * Adds an item to the children of a node
- *
- * \param p_playlist the playlist
- * \param p_item the item to append
- * \param p_parent the parent node
- * \return VLC_SUCCESS or an error
- */
-int playlist_NodeAppend( playlist_t *p_playlist,
- playlist_item_t *p_item,
- playlist_item_t *p_parent )
-{
- return playlist_NodeInsert( p_playlist, p_item, p_parent, -1 );
-}
-
int playlist_NodeInsert( playlist_t *p_playlist,
playlist_item_t *p_item,
playlist_item_t *p_parent,
More information about the vlc-commits
mailing list