[vlc-devel] [PATCH 11/11] playlist: playlist_Create: prevent compilation if public-data is not first member
Filip Roséen
filip at atch.se
Thu May 18 12:01:18 CEST 2017
As offsetof is usuable in a constant-expression, the usage of assert
has been replaced with static_assert.
---
src/playlist/engine.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index fce5d6879e..f83651c55e 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -203,7 +203,9 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
if( !p )
return NULL;
- assert( offsetof( playlist_private_t, public_data ) == 0 );
+ 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;
--
2.12.2
More information about the vlc-devel
mailing list