[vlc-commits] playlist: make playlist_IsEmpty a macro
Rémi Denis-Courmont
git at videolan.org
Sun Oct 21 13:01:36 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 20 23:33:24 2018 +0300| [b04f4fc2f289a9dc63e613d125eed82cad0e45eb] | committer: Rémi Denis-Courmont
playlist: make playlist_IsEmpty a macro
This will become necessary later.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b04f4fc2f289a9dc63e613d125eed82cad0e45eb
---
include/vlc_playlist.h | 19 +++++--------------
src/playlist/control.c | 3 ++-
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 51f1d0e82b..a0608f7f34 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -285,7 +285,7 @@ VLC_API void playlist_Lock( playlist_t * );
*/
VLC_API void playlist_Unlock( playlist_t * );
-VLC_API void playlist_AssertLocked( playlist_t * );
+VLC_API playlist_t *playlist_AssertLocked( playlist_t * );
VLC_API void playlist_Deactivate( playlist_t * );
/**
@@ -412,22 +412,13 @@ static inline int playlist_MuteToggle( playlist_t *pl )
VLC_API void playlist_EnableAudioFilter( playlist_t *, const char *, bool );
-/***********************************************************************
- * Inline functions
- ***********************************************************************/
/** Tell if the playlist is empty */
-static inline bool playlist_IsEmpty( playlist_t *p_playlist )
-{
- PL_ASSERT_LOCKED;
- return p_playlist->items.i_size == 0;
-}
+#define playlist_IsEmpty(p_playlist) \
+ (playlist_AssertLocked(p_playlist)->items.i_size == 0)
/** Tell the number of items in the current playing context */
-static inline int playlist_CurrentSize( playlist_t *p_playlist )
-{
- PL_ASSERT_LOCKED;
- return p_playlist->current.i_size;
-}
+#define playlist_CurrentSize(p_playlist) \
+ (playlist_AssertLocked(p_playlist)->current.i_size)
/** @} */
# ifdef __cplusplus
diff --git a/src/playlist/control.c b/src/playlist/control.c
index bed2cdf8c1..61d5e4c063 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -44,9 +44,10 @@ void playlist_Unlock( playlist_t *pl )
vlc_mutex_unlock( &pl_priv(pl)->lock );
}
-void playlist_AssertLocked( playlist_t *pl )
+playlist_t *playlist_AssertLocked( playlist_t *pl )
{
vlc_mutex_assert( &pl_priv(pl)->lock );
+ return pl;
}
static void playlist_vaControl( playlist_t *p_playlist, int i_query,
More information about the vlc-commits
mailing list