vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Oct 20 23:48:26 2018 +0300| [3c4a2f30f894aa3e7f7e64573e889cc52cadcbbe] | committer: Rémi Denis-Courmont
playlist: export locked status instead of assertion Expanding the assertion in the calling code provides much more helpful source code references in case of failure. Previously, the assertion was expanded only in one place for the entire code base. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3c4a2f30f894aa3e7f7e64573e889cc52cadcbbe --- include/vlc_playlist.h | 6 ++++-- src/libvlccore.sym | 2 +- src/playlist/control.c | 5 ++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h index a0608f7f34..4b8aa2b832 100644 --- a/include/vlc_playlist.h +++ b/include/vlc_playlist.h @@ -211,7 +211,7 @@ enum pl_locked_state /* Helpers */ #define PL_LOCK playlist_Lock( p_playlist ) #define PL_UNLOCK playlist_Unlock( p_playlist ) -#define PL_ASSERT_LOCKED playlist_AssertLocked( p_playlist ) +#define PL_ASSERT_LOCKED assert(playlist_Locked(p_playlist)) /** Playlist commands */ enum { @@ -285,7 +285,9 @@ VLC_API void playlist_Lock( playlist_t * ); */ VLC_API void playlist_Unlock( playlist_t * ); -VLC_API playlist_t *playlist_AssertLocked( playlist_t * ); +VLC_API bool playlist_Locked( const playlist_t * ); +#define playlist_AssertLocked(pl) (assert(playlist_Locked(pl)), pl) + VLC_API void playlist_Deactivate( playlist_t * ); /** diff --git a/src/libvlccore.sym b/src/libvlccore.sym index d9ffbd1b11..cf0a7e091c 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -328,7 +328,7 @@ plane_CopyPixels playlist_Add playlist_AddExt playlist_AddInput -playlist_AssertLocked +playlist_Locked playlist_ChildSearchName playlist_Clear playlist_Control diff --git a/src/playlist/control.c b/src/playlist/control.c index 61d5e4c063..7c0142cd0b 100644 --- a/src/playlist/control.c +++ b/src/playlist/control.c @@ -44,10 +44,9 @@ void playlist_Unlock( playlist_t *pl ) vlc_mutex_unlock( &pl_priv(pl)->lock ); } -playlist_t *playlist_AssertLocked( playlist_t *pl ) +bool playlist_Locked( const playlist_t *pl ) { - vlc_mutex_assert( &pl_priv(pl)->lock ); - return pl; + return vlc_mutex_marked( &pl_priv(pl)->lock ); } static void playlist_vaControl( playlist_t *p_playlist, int i_query, _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
