[vlc-devel] [PATCH] Embed vlc_object_t for subtyping (strict aliasing)

Romain Vimont rom1v at videolabs.io
Sun Jun 10 19:34:40 CEST 2018


With strict aliasing enabled, it is undefined to access a field after a
cast to an unrelated type, even if both types declare the same field.

Concretely, in the following example:

    struct vlc_common_members {
        // common members
    };

    struct vlc_object_t {
        struct vlc_common_members obj;
    };

    struct some_type_t {
        struct vlc_common_members obj;
    };

    struct some_type_t *x = ...;
    struct vlc_object_t *o = (vlc_object_t *) x;

It is undefined to access x->obj through o->obj.

However, it is well-defined if some_type_t _contains_ vlc_object_t:

    struct vlc_object_t {
        // common members
    };

    struct some_type_t {
        struct vlc_object_t obj;
    };

<https://blog.regehr.org/archives/1307>
<https://stackoverflow.com/questions/19010971/compatible-types-vs-strict-aliasing-rules>
---
 include/vlc_addons.h                          |  4 +--
 include/vlc_aout.h                            |  2 +-
 include/vlc_aout_volume.h                     |  2 +-
 include/vlc_codec.h                           |  4 +--
 include/vlc_demux.h                           |  2 +-
 include/vlc_events.h                          |  6 ++--
 include/vlc_extensions.h                      |  2 +-
 include/vlc_filter.h                          |  2 +-
 include/vlc_fingerprinter.h                   |  2 +-
 include/vlc_inhibit.h                         |  2 +-
 include/vlc_input.h                           |  2 +-
 include/vlc_interface.h                       |  2 +-
 include/vlc_keystore.h                        |  2 +-
 include/vlc_meta.h                            |  2 +-
 include/vlc_meta_fetcher.h                    |  2 +-
 include/vlc_objects.h                         | 29 +++--------------
 include/vlc_opengl.h                          |  2 +-
 include/vlc_playlist.h                        |  4 +--
 include/vlc_probe.h                           |  2 +-
 include/vlc_renderer_discovery.h              |  2 +-
 include/vlc_services_discovery.h              |  2 +-
 include/vlc_sout.h                            |  8 ++---
 include/vlc_spu.h                             |  2 +-
 include/vlc_stream.h                          |  2 +-
 include/vlc_stream_extractor.h                |  4 +--
 include/vlc_tls.h                             |  2 +-
 include/vlc_video_splitter.h                  |  2 +-
 include/vlc_vod.h                             |  2 +-
 include/vlc_vout.h                            |  2 +-
 include/vlc_vout_display.h                    |  2 +-
 include/vlc_vout_window.h                     |  2 +-
 include/vlc_xml.h                             |  4 +--
 lib/media_player_internal.h                   |  2 +-
 modules/audio_output/mmdevice.h               |  2 +-
 modules/codec/avcodec/encoder.c               |  2 +-
 modules/codec/avcodec/va.h                    |  2 +-
 modules/control/oldrc.c                       |  2 +-
 modules/demux/mpeg/ps.c                       |  2 +-
 modules/gui/ncurses.c                         |  4 +--
 modules/gui/qt/dialogs/messages.cpp           |  2 +-
 modules/keystore/secret.c                     |  2 +-
 modules/lua/libs/misc.c                       |  2 +-
 modules/lua/libs/objects.c                    |  2 +-
 modules/lua/libs/variables.c                  |  4 +--
 modules/misc/logger.c                         |  2 +-
 modules/misc/webservices/acoustid.c           |  6 ++--
 modules/services_discovery/podcast.c          |  2 +-
 modules/spu/mosaic.h                          |  2 +-
 .../chromecast/chromecast_communication.cpp   |  2 +-
 .../stream_out/chromecast/chromecast_ctrl.cpp | 10 +++---
 modules/video_output/opengl/converter.h       |  2 +-
 modules/video_output/xcb/window.c             | 12 +++----
 src/input/input_internal.h                    |  2 +-
 src/input/vlm.c                               |  4 +--
 src/input/vlm_internal.h                      |  2 +-
 src/interface/dialog.c                        |  4 +--
 src/misc/actions.c                            |  2 +-
 src/misc/keystore.c                           |  2 +-
 src/misc/messages.c                           | 14 ++++----
 src/misc/objects.c                            | 32 +++++++++----------
 src/misc/update.h                             |  2 +-
 src/misc/variables.c                          |  2 +-
 src/modules/modules.c                         |  8 ++---
 src/network/httpd.c                           |  2 +-
 src/video_output/vout_spuregion_helper.h      |  6 ++--
 65 files changed, 119 insertions(+), 140 deletions(-)

diff --git a/include/vlc_addons.h b/include/vlc_addons.h
index c1131e0715..7447c7e8cd 100644
--- a/include/vlc_addons.h
+++ b/include/vlc_addons.h
@@ -106,7 +106,7 @@ typedef struct addons_finder_t addons_finder_t;
 typedef struct addons_finder_sys_t addons_finder_sys_t;
 struct addons_finder_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     int ( * pf_find )( addons_finder_t * );
     int ( * pf_retrieve )( addons_finder_t *, addon_entry_t * );
@@ -120,7 +120,7 @@ typedef struct addons_storage_t addons_storage_t;
 typedef struct addons_storage_sys_t addons_storage_sys_t;
 struct addons_storage_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     int ( * pf_install )( addons_storage_t *, addon_entry_t * );
     int ( * pf_remove )( addons_storage_t *, addon_entry_t * );
diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index f03b26d4fb..7dba116187 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -136,7 +136,7 @@ struct vlc_audio_output_events {
  **/
 struct audio_output
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     void *sys; /**< Private data for callbacks */
 
diff --git a/include/vlc_aout_volume.h b/include/vlc_aout_volume.h
index ee8125e723..ad6ae7baff 100644
--- a/include/vlc_aout_volume.h
+++ b/include/vlc_aout_volume.h
@@ -44,7 +44,7 @@ typedef struct audio_volume audio_volume_t;
  */
 struct audio_volume
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     vlc_fourcc_t format; /**< Audio samples format */
     void (*amplify)(audio_volume_t *, block_t *, float); /**< Amplifier */
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 75b9ed3ddf..e7e035bd3e 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -98,7 +98,7 @@ struct decoder_owner_callbacks
  */
 struct decoder_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module properties */
     module_t *          p_module;
@@ -216,7 +216,7 @@ struct decoder_cc_desc_t
 
 struct encoder_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module properties */
     module_t *          p_module;
diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 3888ac57ce..b7a1691f8a 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -54,7 +54,7 @@
 /* demux_meta_t is returned by "meta reader" module to the demuxer */
 typedef struct demux_meta_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     input_item_t *p_item; /***< the input item that is being read */
 
     vlc_meta_t *p_meta;                 /**< meta data */
diff --git a/include/vlc_events.h b/include/vlc_events.h
index 22efabef07..5d4d48ed76 100644
--- a/include/vlc_events.h
+++ b/include/vlc_events.h
@@ -47,9 +47,9 @@
  * (see src/misc/variables.c).
  *
  * It has the following advantages over Variable based Callback:
- * - No need to implement the whole vlc_common_members in the object,
+ * - No need to implement the whole vlc_object_t in the object,
  * thus it reduce it size. This is especially true for input_item_t which
- * doesn't have vlc_common_members. This is the first reason of existence of
+ * doesn't have vlc_object_t. This is the first reason of existence of
  * this implementation.
  * - Libvlc can easily be based upon that.
  * - Existing event are clearly declared (in include/vlc_events.h)
@@ -57,7 +57,7 @@
  *
  **** Example usage
  *
- * (vlc_cool_object_t doesn't need to have the vlc_common_members.)
+ * (vlc_cool_object_t doesn't need to have the vlc_object_t.)
  *
  * struct vlc_cool_object_t
  * {
diff --git a/include/vlc_extensions.h b/include/vlc_extensions.h
index 0312835549..5ec9914365 100644
--- a/include/vlc_extensions.h
+++ b/include/vlc_extensions.h
@@ -52,7 +52,7 @@ typedef struct extension_t {
 /** Extensions manager object */
 struct extensions_manager_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     module_t *p_module;                /**< Extensions manager module */
     extensions_manager_sys_t *p_sys;   /**< Reserved for the module */
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index eb7624aa55..ac69c5bfaf 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -64,7 +64,7 @@ struct vlc_mouse_t;
  */
 struct filter_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module properties */
     module_t *          p_module;
diff --git a/include/vlc_fingerprinter.h b/include/vlc_fingerprinter.h
index aba6d8e2b2..200f3ae167 100644
--- a/include/vlc_fingerprinter.h
+++ b/include/vlc_fingerprinter.h
@@ -68,7 +68,7 @@ static inline void fingerprint_request_Delete( fingerprint_request_t *p_f )
 
 struct fingerprinter_thread_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Specific interfaces */
     fingerprinter_sys_t * p_sys;
diff --git a/include/vlc_inhibit.h b/include/vlc_inhibit.h
index 00abfab0bd..f1d373e189 100644
--- a/include/vlc_inhibit.h
+++ b/include/vlc_inhibit.h
@@ -42,7 +42,7 @@ enum vlc_inhibit_flags
 
 struct vlc_inhibit
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     vlc_inhibit_sys_t *p_sys;
     void (*inhibit) (vlc_inhibit_t *, unsigned flags);
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 16c566a15b..fc5b661bac 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -225,7 +225,7 @@ typedef struct input_resource_t input_resource_t;
  */
 struct input_thread_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 };
 
 /**
diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index 85b9d81534..4437d23104 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -46,7 +46,7 @@ typedef struct intf_sys_t intf_sys_t;
 /** Describe all interface-specific data of the interface thread */
 typedef struct intf_thread_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
 
diff --git a/include/vlc_keystore.h b/include/vlc_keystore.h
index 8fe8964b0b..80262987c2 100644
--- a/include/vlc_keystore.h
+++ b/include/vlc_keystore.h
@@ -294,7 +294,7 @@ vlc_keystore_release_entry(vlc_keystore_entry *p_entry)
 typedef struct vlc_keystore_sys vlc_keystore_sys;
 struct vlc_keystore
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     module_t            *p_module;
     vlc_keystore_sys    *p_sys;
 
diff --git a/include/vlc_meta.h b/include/vlc_meta.h
index 954a8342b7..7a5d31d97c 100644
--- a/include/vlc_meta.h
+++ b/include/vlc_meta.h
@@ -99,7 +99,7 @@ VLC_API const char * vlc_meta_TypeToLocalizedString( vlc_meta_type_t meta_type )
 
 typedef struct meta_export_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     input_item_t *p_item;
     const char *psz_file;
 } meta_export_t;
diff --git a/include/vlc_meta_fetcher.h b/include/vlc_meta_fetcher.h
index da9a353e06..d540b2d371 100644
--- a/include/vlc_meta_fetcher.h
+++ b/include/vlc_meta_fetcher.h
@@ -30,7 +30,7 @@ typedef enum meta_fetcher_scope_t
 
 typedef struct meta_fetcher_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     input_item_t *p_item;
     meta_fetcher_scope_t e_scope;
 } meta_fetcher_t;
diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index f619936504..780d56121a 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -36,7 +36,7 @@
  * Object also have private properties maintained by the core, see
  * \ref vlc_object_internals_t
  */
-struct vlc_common_members
+struct vlc_object_t
 {
     /** Object type name
      *
@@ -75,39 +75,18 @@ struct vlc_common_members
 };
 
 /**
- * Type-safe vlc_object_t cast
- *
- * This macro attempts to cast a pointer to a compound type to a
- * \ref vlc_object_t pointer in a type-safe manner.
- * It checks if the compound type actually starts with an embedded
- * \ref vlc_object_t structure.
+ * vlc_object_t cast
  */
-#if !defined(__cplusplus)
-# define VLC_OBJECT(x) \
-    _Generic((x)->obj, \
-        struct vlc_common_members: (vlc_object_t *)(x) \
-    )
-#else
-# define VLC_OBJECT(x) ((vlc_object_t *)(x))
-#endif
+#define VLC_OBJECT(x) ((vlc_object_t *)(x))
 
 /* Object flags */
 #define OBJECT_FLAGS_QUIET       0x0002
 #define OBJECT_FLAGS_NOINTERACT  0x0004
 
-/*****************************************************************************
- * The vlc_object_t type. Yes, it's that simple :-)
- *****************************************************************************/
-/** The main vlc_object_t structure */
-struct vlc_object_t
-{
-    struct vlc_common_members obj;
-};
-
 /* The root object */
 struct libvlc_int_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 };
 
 /*****************************************************************************
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index 57a1e71c3b..5bcaaa9733 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -39,7 +39,7 @@ typedef struct vlc_gl_t vlc_gl_t;
 
 struct vlc_gl_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     struct vout_window_t *surface;
     module_t *module;
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index d18751f627..a4e5e2b4df 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -116,7 +116,7 @@ struct intf_thread_t;
 /** Helper structure to export to file part of the playlist */
 typedef struct playlist_export_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     char *base_url;
     FILE *p_file;
     playlist_item_t *p_root;
@@ -150,7 +150,7 @@ typedef enum
 /** Structure containing information about the playlist */
 struct playlist_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     playlist_item_array_t items; /**< Arrays of items */
 
diff --git a/include/vlc_probe.h b/include/vlc_probe.h
index 89ba938817..3ed31068b2 100644
--- a/include/vlc_probe.h
+++ b/include/vlc_probe.h
@@ -38,7 +38,7 @@ void *vlc_probe (vlc_object_t *, const char *, size_t *);
 
 struct vlc_probe_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     void  *list;
     size_t count;
diff --git a/include/vlc_renderer_discovery.h b/include/vlc_renderer_discovery.h
index fcb0cd7d2d..210a435b48 100644
--- a/include/vlc_renderer_discovery.h
+++ b/include/vlc_renderer_discovery.h
@@ -164,7 +164,7 @@ struct vlc_renderer_discovery_owner
 
 struct vlc_renderer_discovery_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     module_t *          p_module;
 
     struct vlc_renderer_discovery_owner owner;
diff --git a/include/vlc_services_discovery.h b/include/vlc_services_discovery.h
index 682a3654cf..596f426347 100644
--- a/include/vlc_services_discovery.h
+++ b/include/vlc_services_discovery.h
@@ -53,7 +53,7 @@ struct services_discovery_owner_t
  */
 struct services_discovery_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     module_t *          p_module;             /**< Loaded module */
 
     char *psz_name;                           /**< Main name of the SD */
diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 7e4a8d4a45..4172e09635 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -47,7 +47,7 @@ extern "C" {
  * invalid unsynchronized access) */
 struct sout_instance_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     char *psz_sout;
 
@@ -67,7 +67,7 @@ struct sout_instance_t
 /** Stream output access_output */
 struct sout_access_out_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     module_t                *p_module;
     char                    *psz_access;
@@ -115,7 +115,7 @@ static inline bool sout_AccessOutCanControlPace( sout_access_out_t *p_ao )
 /** Muxer structure */
 struct  sout_mux_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     module_t            *p_module;
 
     sout_instance_t     *p_sout;
@@ -191,7 +191,7 @@ enum sout_stream_query_e {
 
 struct sout_stream_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     module_t          *p_module;
     sout_instance_t   *p_sout;
diff --git a/include/vlc_spu.h b/include/vlc_spu.h
index dc8ea90fa6..44510a0880 100644
--- a/include/vlc_spu.h
+++ b/include/vlc_spu.h
@@ -46,7 +46,7 @@ typedef struct spu_private_t spu_private_t;
  */
 struct spu_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     spu_private_t *p;
 };
diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index b66f15966c..eaa51505e5 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -45,7 +45,7 @@ extern "C" {
 
 struct stream_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     char        *psz_name;
     char        *psz_url; /**< Full URL or MRL (can be NULL) */
diff --git a/include/vlc_stream_extractor.h b/include/vlc_stream_extractor.h
index 0f628eb88b..1090c70cd7 100644
--- a/include/vlc_stream_extractor.h
+++ b/include/vlc_stream_extractor.h
@@ -48,7 +48,7 @@ extern "C" {
  **/
 
 typedef struct stream_extractor_t {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /**
      * \name Callbacks for entity extraction
@@ -71,7 +71,7 @@ typedef struct stream_extractor_t {
 } stream_extractor_t;
 
 typedef struct stream_directory_t {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /**
      * \name Callbacks for stream directories
diff --git a/include/vlc_tls.h b/include/vlc_tls.h
index a13471598f..74ae32bb28 100644
--- a/include/vlc_tls.h
+++ b/include/vlc_tls.h
@@ -66,7 +66,7 @@ typedef struct vlc_tls
  */
 typedef struct vlc_tls_creds
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     module_t *module;
     void *sys;
diff --git a/include/vlc_video_splitter.h b/include/vlc_video_splitter.h
index 6e25c1e05a..d2f5220470 100644
--- a/include/vlc_video_splitter.h
+++ b/include/vlc_video_splitter.h
@@ -69,7 +69,7 @@ typedef struct
  */
 struct video_splitter_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module properties */
     module_t        *p_module;
diff --git a/include/vlc_vod.h b/include/vlc_vod.h
index 6fb7ed0a8a..573e47c9f2 100644
--- a/include/vlc_vod.h
+++ b/include/vlc_vod.h
@@ -35,7 +35,7 @@
 
 struct vod_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module properties */
     module_t  *p_module;
diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index 89d9821438..ecc19c554a 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -58,7 +58,7 @@ typedef struct vout_thread_sys_t vout_thread_sys_t;
  * structure.
  */
 struct vout_thread_t {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Private vout_thread data */
     vout_thread_sys_t *p;
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 4dd63446a4..9eda90504b 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -209,7 +209,7 @@ struct vout_display_owner_t {
 };
 
 struct vout_display_t {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module */
     module_t *module;
diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index 4f65cc1158..8205fbceda 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -146,7 +146,7 @@ typedef struct vout_window_owner {
  * Finally, it must support some control requests such as for fullscreen mode.
  */
 struct vout_window_t {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
      /**
       * Window handle type
diff --git a/include/vlc_xml.h b/include/vlc_xml.h
index 61abc74cf8..9e0b48e147 100644
--- a/include/vlc_xml.h
+++ b/include/vlc_xml.h
@@ -35,7 +35,7 @@ extern "C" {
 
 struct xml_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* Module properties */
     module_t  *p_module;
@@ -64,7 +64,7 @@ static inline void xml_CatalogAdd( xml_t *xml, const char *type,
 
 struct xml_reader_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     void     *p_sys;
     stream_t *p_stream;
diff --git a/lib/media_player_internal.h b/lib/media_player_internal.h
index 20b26e9221..b2cacdac8d 100644
--- a/lib/media_player_internal.h
+++ b/lib/media_player_internal.h
@@ -38,7 +38,7 @@
 
 struct libvlc_media_player_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     int                i_refcount;
     vlc_mutex_t        object_lock;
diff --git a/modules/audio_output/mmdevice.h b/modules/audio_output/mmdevice.h
index 64cf730b30..52dc443167 100644
--- a/modules/audio_output/mmdevice.h
+++ b/modules/audio_output/mmdevice.h
@@ -33,7 +33,7 @@ typedef struct aout_stream aout_stream_t;
  */
 struct aout_stream
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     void *sys;
 
     HRESULT (*time_get)(aout_stream_t *, mtime_t *);
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 8f9408a221..e7450fe408 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -73,7 +73,7 @@ struct thread_context_t;
  *****************************************************************************/
 struct thread_context_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     AVCodecContext  *p_context;
     int             (* pf_func)(AVCodecContext *c, void *arg);
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 178047ad16..7432c8b346 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -30,7 +30,7 @@ typedef struct vlc_va_t vlc_va_t;
 typedef struct vlc_va_sys_t vlc_va_sys_t;
 
 struct vlc_va_t {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     vlc_va_sys_t *sys;
     module_t *module;
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index c40cd2d72a..cfe7f09c2c 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1405,7 +1405,7 @@ static int Quit( vlc_object_t *p_this, char const *psz_cmd,
     VLC_UNUSED(p_data); VLC_UNUSED(psz_cmd);
     VLC_UNUSED(oldval); VLC_UNUSED(newval);
 
-    libvlc_Quit( p_this->obj.libvlc );
+    libvlc_Quit( p_this->libvlc );
     return VLC_SUCCESS;
 }
 
diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index f254102e5d..3576c4281c 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -248,7 +248,7 @@ static int OpenForce( vlc_object_t *p_this )
 
 static int Open( vlc_object_t *p_this )
 {
-    return OpenCommon( p_this, p_this->obj.force );
+    return OpenCommon( p_this, p_this->force );
 }
 
 /*****************************************************************************
diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 876eda8ac4..b0ff6f3d95 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -710,7 +710,7 @@ static int SubDrawObject(intf_sys_t *sys, int l, vlc_object_t *p_obj, int i_leve
 {
     char *name = vlc_object_get_name(p_obj);
     MainBoxWrite(sys, l++, "%*s%s%s \"%s\" (%p)", 2 * i_level++, "", prefix,
-                  p_obj->obj.object_type, name ? name : "", (void *)p_obj);
+                  p_obj->object_type, name ? name : "", (void *)p_obj);
     free(name);
 
     vlc_list_t *list = vlc_list_children(p_obj);
@@ -1853,7 +1853,7 @@ static void Close(vlc_object_t *p_this)
 
     endwin();   /* Close the ncurses interface */
 
-    vlc_LogSet(p_this->obj.libvlc, NULL, NULL);
+    vlc_LogSet(p_this->libvlc, NULL, NULL);
     vlc_mutex_destroy(&sys->msg_lock);
     for(unsigned i = 0; i < sizeof sys->msgs / sizeof *sys->msgs; i++) {
         if (sys->msgs[i].item)
diff --git a/modules/gui/qt/dialogs/messages.cpp b/modules/gui/qt/dialogs/messages.cpp
index c015868244..a460abaa82 100644
--- a/modules/gui/qt/dialogs/messages.cpp
+++ b/modules/gui/qt/dialogs/messages.cpp
@@ -298,7 +298,7 @@ void MessagesDialog::buildTree( QTreeWidgetItem *parentItem,
 
     char *name = vlc_object_get_name( p_obj );
     item->setText( 0, QString("%1%2 (0x%3)")
-                   .arg( qfu( p_obj->obj.object_type ) )
+                   .arg( qfu( p_obj->object_type ) )
                    .arg( ( name != NULL )
                          ? QString( " \"%1\"" ).arg( qfu( name ) )
                              : "" )
diff --git a/modules/keystore/secret.c b/modules/keystore/secret.c
index d4d663d5c9..d1f1e39acd 100644
--- a/modules/keystore/secret.c
+++ b/modules/keystore/secret.c
@@ -293,7 +293,7 @@ dbus_vanished_cb(GDBusConnection *connection, const gchar *name,
 static int
 Open(vlc_object_t *p_this)
 {
-    if (!p_this->obj.force)
+    if (!p_this->force)
     {
         /* First, check if secrets service is running using g_bus_watch_name().
          * Indeed, secret_service_get_sync will spawn a service if it's not
diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c
index 7aecce03bb..963ec68f42 100644
--- a/modules/lua/libs/misc.c
+++ b/modules/lua/libs/misc.c
@@ -123,7 +123,7 @@ static int vlclua_quit( lua_State *L )
     vlc_object_t *p_this = vlclua_get_this( L );
     /* The rc.c code also stops the playlist ... not sure if this is needed
      * though. */
-    libvlc_Quit( p_this->obj.libvlc );
+    libvlc_Quit( p_this->libvlc );
     return 0;
 }
 
diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index 7a847a32f1..aa892e3b76 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -59,7 +59,7 @@ static int vlclua_object_find( lua_State *L )
 
 static int vlclua_get_libvlc( lua_State *L )
 {
-    libvlc_int_t *p_libvlc = vlclua_get_this( L )->obj.libvlc;
+    libvlc_int_t *p_libvlc = vlclua_get_this( L )->libvlc;
     vlc_object_hold( p_libvlc );
     vlclua_push_vlc_object( L, p_libvlc );
     return 1;
diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index 76e4290f13..20823f22fc 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -259,14 +259,14 @@ static int vlclua_libvlc_command( lua_State *L )
     const char *psz_cmd = luaL_checkstring( L, 1 );
     val_arg.psz_string = (char*)luaL_optstring( L, 2, "" );
 
-    int i_type = var_Type( p_this->obj.libvlc, psz_cmd );
+    int i_type = var_Type( p_this->libvlc, psz_cmd );
     if( ! (i_type & VLC_VAR_ISCOMMAND) )
     {
         return luaL_error( L, "libvlc's \"%s\" is not a command",
                            psz_cmd );
     }
 
-    int i_ret = var_Set( p_this->obj.libvlc, psz_cmd, val_arg );
+    int i_ret = var_Set( p_this->libvlc, psz_cmd, val_arg );
     lua_pop( L, 2 );
 
     return vlclua_push_ret( L, i_ret );
diff --git a/modules/misc/logger.c b/modules/misc/logger.c
index 84822fdf3f..cc5ab4335b 100644
--- a/modules/misc/logger.c
+++ b/modules/misc/logger.c
@@ -80,5 +80,5 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     /* Flush the queue and unsubscribe from the message queue */
-    vlc_LogSet( p_this->obj.libvlc, NULL, NULL );
+    vlc_LogSet( p_this->libvlc, NULL, NULL );
 }
diff --git a/modules/misc/webservices/acoustid.c b/modules/misc/webservices/acoustid.c
index 4b6ae2eb3e..09a8fdb11f 100644
--- a/modules/misc/webservices/acoustid.c
+++ b/modules/misc/webservices/acoustid.c
@@ -160,13 +160,13 @@ int DoAcoustIdWebRequest( vlc_object_t *p_obj, acoustid_fingerprint_t *p_data )
          return VLC_EGENERIC;
 
     msg_Dbg( p_obj, "Querying AcoustID from %s", psz_url );
-    int i_saved_flags = p_obj->obj.flags;
-    p_obj->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    int i_saved_flags = p_obj->flags;
+    p_obj->flags |= OBJECT_FLAGS_NOINTERACT;
 
     stream_t *p_stream = vlc_stream_NewURL( p_obj, psz_url );
 
     free( psz_url );
-    p_obj->obj.flags = i_saved_flags;
+    p_obj->flags = i_saved_flags;
     if ( p_stream == NULL )
         return VLC_EGENERIC;
 
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index 327b58ca3a..ea891bd3ea 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -121,7 +121,7 @@ static void SaveUrls( services_discovery_t *p_sd );
  *****************************************************************************/
 static int Open( vlc_object_t *p_this )
 {
-    if( strcmp( p_this->obj.parent->obj.object_type, "playlist" ) )
+    if( strcmp( p_this->parent->object_type, "playlist" ) )
         return VLC_EGENERIC; /* FIXME: support LibVLC SD too! */
 
     services_discovery_t *p_sd = ( services_discovery_t* )p_this;
diff --git a/modules/spu/mosaic.h b/modules/spu/mosaic.h
index cc7533b353..24be23c963 100644
--- a/modules/spu/mosaic.h
+++ b/modules/spu/mosaic.h
@@ -43,6 +43,6 @@ typedef struct bridge_t
 
 static bridge_t *GetBridge( vlc_object_t *p_object )
 {
-    return var_GetAddress(VLC_OBJECT(p_object->obj.libvlc), "mosaic-struct");
+    return var_GetAddress(VLC_OBJECT(p_object->libvlc), "mosaic-struct");
 }
 #define GetBridge(a) GetBridge( VLC_OBJECT(a) )
diff --git a/modules/stream_out/chromecast/chromecast_communication.cpp b/modules/stream_out/chromecast/chromecast_communication.cpp
index 2574df3a46..58561696b7 100644
--- a/modules/stream_out/chromecast/chromecast_communication.cpp
+++ b/modules/stream_out/chromecast/chromecast_communication.cpp
@@ -44,7 +44,7 @@ ChromecastCommunication::ChromecastCommunication( vlc_object_t* p_module, const
     if (devicePort == 0)
         devicePort = CHROMECAST_CONTROL_PORT;
 
-    m_creds = vlc_tls_ClientCreate( m_module->obj.parent );
+    m_creds = vlc_tls_ClientCreate( m_module->parent );
     if (m_creds == NULL)
         throw std::runtime_error( "Failed to create TLS client" );
 
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 3e157e7f5e..1baaf43c21 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -141,9 +141,9 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
     m_common.pf_set_pause_state  = set_pause_state;
     m_common.pf_set_meta         = set_meta;
 
-    assert( var_Type( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME) == 0 );
-    if (var_Create( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, VLC_VAR_ADDRESS ) == VLC_SUCCESS )
-        var_SetAddress( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, &m_common );
+    assert( var_Type( m_module->parent->parent, CC_SHARED_VAR_NAME) == 0 );
+    if (var_Create( m_module->parent->parent, CC_SHARED_VAR_NAME, VLC_VAR_ADDRESS ) == VLC_SUCCESS )
+        var_SetAddress( m_module->parent->parent, CC_SHARED_VAR_NAME, &m_common );
 
     // Start the Chromecast event thread.
     if (vlc_clone(&m_chromecastThread, ChromecastThread, this,
@@ -152,14 +152,14 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
         vlc_interrupt_destroy( m_ctl_thread_interrupt );
         vlc_cond_destroy( &m_stateChangedCond );
         vlc_cond_destroy( &m_pace_cond );
-        var_SetAddress( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, NULL );
+        var_SetAddress( m_module->parent->parent, CC_SHARED_VAR_NAME, NULL );
         throw std::runtime_error( "error creating cc thread" );
     }
 }
 
 intf_sys_t::~intf_sys_t()
 {
-    var_Destroy( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME );
+    var_Destroy( m_module->parent->parent, CC_SHARED_VAR_NAME );
 
     vlc_mutex_lock(&m_lock);
     if( m_communication )
diff --git a/modules/video_output/opengl/converter.h b/modules/video_output/opengl/converter.h
index 229f2bd20b..da34c23326 100644
--- a/modules/video_output/opengl/converter.h
+++ b/modules/video_output/opengl/converter.h
@@ -250,7 +250,7 @@ struct pl_shader_res;
 typedef struct opengl_tex_converter_t opengl_tex_converter_t;
 struct opengl_tex_converter_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     module_t *p_module;
 
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 793adb3eeb..5a3d26180e 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -738,13 +738,13 @@ static int AcquireDrawable (vlc_object_t *obj, xcb_window_t window)
     xcb_window_t *used;
     size_t n = 0;
 
-    if (var_Create (obj->obj.libvlc, "xid-in-use", VLC_VAR_ADDRESS))
+    if (var_Create (obj->libvlc, "xid-in-use", VLC_VAR_ADDRESS))
         return VLC_ENOMEM;
 
     /* Keep a list of busy drawables, so we don't overlap videos if there are
      * more than one video track in the stream. */
     vlc_mutex_lock (&serializer);
-    used = var_GetAddress (obj->obj.libvlc, "xid-in-use");
+    used = var_GetAddress (obj->libvlc, "xid-in-use");
     if (used != NULL)
     {
         while (used[n])
@@ -760,7 +760,7 @@ static int AcquireDrawable (vlc_object_t *obj, xcb_window_t window)
     {
         used[n] = window;
         used[n + 1] = 0;
-        var_SetAddress (obj->obj.libvlc, "xid-in-use", used);
+        var_SetAddress (obj->libvlc, "xid-in-use", used);
     }
     else
     {
@@ -780,7 +780,7 @@ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
     size_t n = 0;
 
     vlc_mutex_lock (&serializer);
-    used = var_GetAddress (obj->obj.libvlc, "xid-in-use");
+    used = var_GetAddress (obj->libvlc, "xid-in-use");
     assert (used);
     while (used[n] != window)
     {
@@ -792,7 +792,7 @@ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
     while (used[++n]);
 
     if (!used[0])
-        var_SetAddress (obj->obj.libvlc, "xid-in-use", NULL);
+        var_SetAddress (obj->libvlc, "xid-in-use", NULL);
     else
         used = NULL;
 
@@ -801,7 +801,7 @@ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
     free( used );
 
     /* Variables are reference-counted... */
-    var_Destroy (obj->obj.libvlc, "xid-in-use");
+    var_Destroy (obj->libvlc, "xid-in-use");
 }
 
 /**
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index c0b8ae4756..60d5c4ae57 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -46,7 +46,7 @@ struct input_stats;
 /* input_source_t: gathers all information per input source */
 typedef struct
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     demux_t  *p_demux; /**< Demux object (most downstream) */
 
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 492fca6288..8a2aed39b3 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -117,7 +117,7 @@ static vlc_mutex_t vlm_mutex = VLC_STATIC_MUTEX;
  *****************************************************************************/
 vlm_t *vlm_New ( vlc_object_t *p_this, const char *psz_vlmconf )
 {
-    vlm_t *p_vlm = NULL, **pp_vlm = &(libvlc_priv (p_this->obj.libvlc)->p_vlm);
+    vlm_t *p_vlm = NULL, **pp_vlm = &(libvlc_priv (p_this->libvlc)->p_vlm);
 
     /* Avoid multiple creation */
     vlc_mutex_lock( &vlm_mutex );
@@ -135,7 +135,7 @@ vlm_t *vlm_New ( vlc_object_t *p_this, const char *psz_vlmconf )
 
     msg_Dbg( p_this, "creating VLM" );
 
-    p_vlm = vlc_custom_create( p_this->obj.libvlc, sizeof( *p_vlm ),
+    p_vlm = vlc_custom_create( p_this->libvlc, sizeof( *p_vlm ),
                                "vlm daemon" );
     if( !p_vlm )
     {
diff --git a/src/input/vlm_internal.h b/src/input/vlm_internal.h
index 0f6cc9c875..06d2c7804f 100644
--- a/src/input/vlm_internal.h
+++ b/src/input/vlm_internal.h
@@ -83,7 +83,7 @@ typedef struct
 
 struct vlm_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     vlc_mutex_t  lock;
     vlc_thread_t thread;
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 459c41602b..4ec2a7b168 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -122,11 +122,11 @@ struct dialog_i11e_context
 static inline vlc_dialog_provider *
 get_dialog_provider(vlc_object_t *p_obj, bool b_check_interact)
 {
-    if (b_check_interact && p_obj->obj.flags & OBJECT_FLAGS_NOINTERACT)
+    if (b_check_interact && p_obj->flags & OBJECT_FLAGS_NOINTERACT)
         return NULL;
 
     vlc_dialog_provider *p_provider =
-        libvlc_priv(p_obj->obj.libvlc)->p_dialog_provider;
+        libvlc_priv(p_obj->libvlc)->p_dialog_provider;
     assert(p_provider != NULL);
     return p_provider;
 }
diff --git a/src/misc/actions.c b/src/misc/actions.c
index 65178c1bf4..090e3c494d 100644
--- a/src/misc/actions.c
+++ b/src/misc/actions.c
@@ -637,6 +637,6 @@ vlc_actions_get_keycodes(vlc_object_t *p_obj, const char *psz_key_name,
 const char* const*
 vlc_actions_get_key_names(vlc_object_t *p_obj)
 {
-    vlc_actions_t *as = libvlc_priv(p_obj->obj.libvlc)->actions;
+    vlc_actions_t *as = libvlc_priv(p_obj->libvlc)->actions;
     return as->ppsz_keys;
 }
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index efedacf1f5..26ad87c611 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -156,7 +156,7 @@ libvlc_InternalKeystoreClean(libvlc_int_t *p_libvlc)
 static vlc_keystore *
 get_memory_keystore(vlc_object_t *p_obj)
 {
-    return libvlc_priv(p_obj->obj.libvlc)->p_memory_keystore;
+    return libvlc_priv(p_obj->libvlc)->p_memory_keystore;
 }
 
 static vlc_keystore_entry *
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 8dda0641f5..84637e882f 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -45,7 +45,7 @@
 
 struct vlc_logger_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
     vlc_rwlock_t lock;
     vlc_log_cb log;
     void *sys;
@@ -90,7 +90,7 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
                 const char *file, unsigned line, const char *func,
                 const char *format, va_list args)
 {
-    if (obj != NULL && obj->obj.flags & OBJECT_FLAGS_QUIET)
+    if (obj != NULL && obj->flags & OBJECT_FLAGS_QUIET)
         return;
 
     /* Get basename from the module filename */
@@ -112,7 +112,7 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
     vlc_log_t msg;
 
     msg.i_object_id = (uintptr_t)obj;
-    msg.psz_object_type = (obj != NULL) ? obj->obj.object_type : "generic";
+    msg.psz_object_type = (obj != NULL) ? obj->object_type : "generic";
     msg.psz_module = module;
     msg.psz_header = NULL;
     msg.file = file;
@@ -120,10 +120,10 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
     msg.func = func;
     msg.tid = vlc_thread_id();
 
-    for (vlc_object_t *o = obj; o != NULL; o = o->obj.parent)
-        if (o->obj.header != NULL)
+    for (vlc_object_t *o = obj; o != NULL; o = o->parent)
+        if (o->header != NULL)
         {
-            msg.psz_header = o->obj.header;
+            msg.psz_header = o->header;
             break;
         }
 
@@ -137,7 +137,7 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
 
     /* Pass message to the callback */
     if (obj != NULL)
-        vlc_vaLogCallback(obj->obj.libvlc, type, &msg, format, args);
+        vlc_vaLogCallback(obj->libvlc, type, &msg, format, args);
 }
 
 /**
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 0d151d78c3..6899f7f931 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -59,10 +59,10 @@ static void PrintObjectPrefix(vlc_object_t *obj, bool last)
 {
     const char *str;
 
-    if (obj->obj.parent == NULL)
+    if (obj->parent == NULL)
         return;
 
-    PrintObjectPrefix(obj->obj.parent, false);
+    PrintObjectPrefix(obj->parent, false);
 
     if (vlc_internals(obj)->next != NULL)
         str = last ? " \xE2\x94\x9C" : " \xE2\x94\x82";
@@ -81,7 +81,7 @@ static void PrintObject(vlc_object_t *obj)
     PrintObjectPrefix(obj, true);
     printf("\xE2\x94\x80\xE2\x94%c\xE2\x95\xB4%p %s, %u refs\n",
            (priv->first != NULL) ? 0xAC : 0x80,
-           (void *)obj, obj->obj.object_type, atomic_load(&priv->refs));
+           (void *)obj, obj->object_type, atomic_load(&priv->refs));
 
     vlc_restorecancel (canc);
 }
@@ -166,7 +166,7 @@ static int VarsCommand (vlc_object_t *obj, char const *cmd,
         vlc_object_hold (obj);
 
     printf(" o %p %s, parent %p\n", (void *)obj,
-           obj->obj.object_type, (void *)obj->obj.parent);
+           obj->object_type, (void *)obj->parent);
     DumpVariables (obj);
     vlc_object_release (obj);
 
@@ -203,20 +203,20 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
     priv->resources = NULL;
 
     vlc_object_t *obj = (vlc_object_t *)(priv + 1);
-    obj->obj.object_type = typename;
-    obj->obj.header = NULL;
-    obj->obj.force = false;
+    obj->object_type = typename;
+    obj->header = NULL;
+    obj->force = false;
     memset (obj + 1, 0, length - sizeof (*obj)); /* type-specific stuff */
 
     if (likely(parent != NULL))
     {
         vlc_object_internals_t *papriv = vlc_internals (parent);
 
-        obj->obj.flags = parent->obj.flags;
-        obj->obj.libvlc = parent->obj.libvlc;
+        obj->flags = parent->flags;
+        obj->libvlc = parent->libvlc;
 
         /* Attach the child to its parent (no lock needed) */
-        obj->obj.parent = vlc_object_hold (parent);
+        obj->parent = vlc_object_hold (parent);
 
         /* Attach the parent to its child (structure lock needed) */
         vlc_mutex_lock (&papriv->tree_lock);
@@ -230,9 +230,9 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
     {
         libvlc_int_t *self = (libvlc_int_t *)obj;
 
-        obj->obj.flags = 0;
-        obj->obj.libvlc = self;
-        obj->obj.parent = NULL;
+        obj->flags = 0;
+        obj->libvlc = self;
+        obj->parent = NULL;
         priv->next = NULL;
 
         /* TODO: should be in src/libvlc.c */
@@ -323,7 +323,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
     if( p_priv->pf_destructor )
         p_priv->pf_destructor( p_this );
 
-    if (unlikely(p_this->obj.parent == NULL))
+    if (unlikely(p_this->parent == NULL))
     {
         /* TODO: should be in src/libvlc.c */
         var_DelCallback (p_this, "vars", VarsCommand, NULL);
@@ -336,7 +336,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
     vlc_mutex_destroy (&p_priv->tree_lock);
     vlc_cond_destroy( &p_priv->var_wait );
     vlc_mutex_destroy( &p_priv->var_lock );
-    free( p_this->obj.header );
+    free( p_this->header );
     free( p_priv->psz_name );
     free( p_priv );
 }
@@ -436,7 +436,7 @@ void vlc_object_release (vlc_object_t *obj)
         assert (refs > 0);
     }
 
-    vlc_object_t *parent = obj->obj.parent;
+    vlc_object_t *parent = obj->parent;
 
     if (unlikely(parent == NULL))
     {   /* Destroying the root object */
diff --git a/src/misc/update.h b/src/misc/update.h
index c5ca7d11c7..227870f0ce 100644
--- a/src/misc/update.h
+++ b/src/misc/update.h
@@ -132,7 +132,7 @@ typedef struct public_key_t public_key_t;
  */
 typedef struct
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     vlc_thread_t thread;
     atomic_bool aborted;
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 26472a465a..89ff26f0be 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1029,7 +1029,7 @@ int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type,
                  vlc_value_t *p_val )
 {
     i_type &= VLC_VAR_CLASS;
-    for( vlc_object_t *obj = p_this; obj != NULL; obj = obj->obj.parent )
+    for( vlc_object_t *obj = p_this; obj != NULL; obj = obj->parent )
     {
         if( var_GetChecked( obj, psz_name, i_type, p_val ) == VLC_SUCCESS )
             return VLC_SUCCESS;
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 6201def20f..5be2ebfc3b 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -217,7 +217,7 @@ module_t *vlc_module_load(vlc_object_t *obj, const char *capability,
     }
 
     module_t *module = NULL;
-    const bool b_force_backup = obj->obj.force; /* FIXME: remove this */
+    const bool b_force_backup = obj->force; /* FIXME: remove this */
     va_list args;
 
     va_start(args, probe);
@@ -232,7 +232,7 @@ module_t *vlc_module_load(vlc_object_t *obj, const char *capability,
         if (!strcasecmp ("none", shortcut))
             goto done;
 
-        obj->obj.force = strict && strcasecmp ("any", shortcut);
+        obj->force = strict && strcasecmp ("any", shortcut);
         for (ssize_t i = 0; i < total; i++)
         {
             module_t *cand = mods[i];
@@ -257,7 +257,7 @@ module_t *vlc_module_load(vlc_object_t *obj, const char *capability,
     /* None of the shortcuts matched, fall back to any module */
     if (!strict)
     {
-        obj->obj.force = false;
+        obj->force = false;
         for (ssize_t i = 0; i < total; i++)
         {
             module_t *cand = mods[i];
@@ -277,7 +277,7 @@ module_t *vlc_module_load(vlc_object_t *obj, const char *capability,
     }
 done:
     va_end (args);
-    obj->obj.force = b_force_backup;
+    obj->force = b_force_backup;
     module_list_free (mods);
 
     if (module != NULL)
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 6cf7a710dc..fd6cada8f1 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -72,7 +72,7 @@ static void httpd_AppendData(httpd_stream_t *stream, uint8_t *p_data, int i_data
 /* each host run in his own thread */
 struct httpd_host_t
 {
-    struct vlc_common_members obj;
+    struct vlc_object_t obj;
 
     /* ref count */
     unsigned    i_ref;
diff --git a/src/video_output/vout_spuregion_helper.h b/src/video_output/vout_spuregion_helper.h
index 451b911915..3060d7c642 100644
--- a/src/video_output/vout_spuregion_helper.h
+++ b/src/video_output/vout_spuregion_helper.h
@@ -70,15 +70,15 @@ spuregion_CreateFromPicture( vlc_object_t *p_this, video_format_t *p_fmt,
     video_format_Init( &fmt_in, 0 );
 
     picture_t *p_pic = NULL;
-    int i_flags = p_this->obj.flags;
-    p_this->obj.flags |= OBJECT_FLAGS_NOINTERACT|OBJECT_FLAGS_QUIET;
+    int i_flags = p_this->flags;
+    p_this->flags |= OBJECT_FLAGS_NOINTERACT|OBJECT_FLAGS_QUIET;
     image_handler_t *p_image = image_HandlerCreate( p_this );
     if( p_image )
     {
         p_pic = image_ReadUrl( p_image, psz_uri, &fmt_in, p_fmt );
         image_HandlerDelete( p_image );
     }
-    p_this->obj.flags = i_flags;
+    p_this->flags = i_flags;
 
     if(!p_pic)
         return NULL;
-- 
2.17.1




More information about the vlc-devel mailing list