[vlc-commits] playlist: fix unused var warning with NDEBUG

Thomas Guillem git at videolan.org
Wed Sep 4 15:10:32 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Sep  4 09:13:40 2019 +0200| [5ae87e748ea0b2307c72350bfcd69bc5670bd6a3] | committer: Thomas Guillem

playlist: fix unused var warning with NDEBUG

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

 src/playlist/notify.c   |  4 +++-
 src/playlist/playlist.h | 10 +++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/playlist/notify.c b/src/playlist/notify.c
index b3133d6a8d..3b69dd1921 100644
--- a/src/playlist/notify.c
+++ b/src/playlist/notify.c
@@ -70,7 +70,9 @@ void
 vlc_playlist_RemoveListener(vlc_playlist_t *playlist,
                             vlc_playlist_listener_id *listener)
 {
-    vlc_playlist_AssertLocked(playlist);
+    /* The playlist head is not needed to remove a node, but the list must be
+     * locked. */
+    vlc_playlist_AssertLocked(playlist); VLC_UNUSED(playlist);
 
     vlc_list_remove(&listener->node);
     free(listener);
diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h
index c1bbab6bba..2a696c6cb0 100644
--- a/src/playlist/playlist.h
+++ b/src/playlist/playlist.h
@@ -63,15 +63,15 @@ struct vlc_playlist
     uint64_t idgen;
 };
 
+/* Also disable vlc_assert_locked in tests since the symbol is not exported */
+#if !defined(NDEBUG) && !defined(TEST_PLAYLIST)
 static inline void
 vlc_playlist_AssertLocked(vlc_playlist_t *playlist)
 {
-#ifdef TEST_PLAYLIST
-    /* disable vlc_assert_locked in tests since the symbol is not exported */
-    VLC_UNUSED(playlist);
-#else
     vlc_player_assert_locked(playlist->player);
-#endif
 }
+#else
+#define vlc_playlist_AssertLocked(x) ((void) (0))
+#endif
 
 #endif



More information about the vlc-commits mailing list