[vlc-commits] playlist: use container_of()

Rémi Denis-Courmont git at videolan.org
Wed Jun 7 22:21:32 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun  7 23:13:37 2017 +0300| [befd23291aa4b1b7b3c30a47a6e2f4ae01522779] | committer: Rémi Denis-Courmont

playlist: use container_of()

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

 src/playlist/engine.c            | 3 ---
 src/playlist/playlist_internal.h | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 2f76043b3a..b5b17d0729 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -193,9 +193,6 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
     if( !p )
         return NULL;
 
-    static_assert( offsetof( playlist_private_t, public_data ) == 0,
-                   "playlist_private_t.public_data must be at offset 0" );
-
     p_playlist = &p->public_data;
 
     p->input_tree = NULL;
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index 78b4b5c46d..ed40679f8f 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -89,7 +89,7 @@ typedef struct playlist_private_t
     bool     b_preparse; /**< Preparse items */
 } playlist_private_t;
 
-#define pl_priv( pl ) ((playlist_private_t *)(pl))
+#define pl_priv( pl ) container_of(pl, playlist_private_t, public_data)
 
 /*****************************************************************************
  * Prototypes



More information about the vlc-commits mailing list