[vlc-commits] object: store a pointer to private data
Rémi Denis-Courmont
git at videolan.org
Sun Apr 14 21:05:29 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 14 18:01:54 2019 +0300| [ed9eaaccd4587e7017ab9b06189df75dff209b04] | committer: Rémi Denis-Courmont
object: store a pointer to private data
This effectively reverts commit 079986827291b3381495532cb0f754b131ccf246.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed9eaaccd4587e7017ab9b06189df75dff209b04
---
include/vlc_objects.h | 2 ++
src/misc/objects.c | 2 ++
src/misc/variables.h | 2 +-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index fc95150cea..4b4527c4f7 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -29,6 +29,7 @@
*/
struct vlc_logger;
+struct vlc_object_internals;
/**
* VLC object common members
@@ -40,6 +41,7 @@ struct vlc_logger;
struct vlc_common_members
{
struct vlc_logger *logger;
+ struct vlc_object_internals *priv;
bool no_interact;
diff --git a/src/misc/objects.c b/src/misc/objects.c
index e03f32ae70..7ca420c3dc 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -85,6 +85,8 @@ 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.priv = priv;
obj->obj.force = false;
memset (obj + 1, 0, length - sizeof (*obj)); /* type-specific stuff */
diff --git a/src/misc/variables.h b/src/misc/variables.h
index 4d214e455a..63f9d49239 100644
--- a/src/misc/variables.h
+++ b/src/misc/variables.h
@@ -48,7 +48,7 @@ struct vlc_object_internals
struct vlc_res *resources;
};
-# define vlc_internals( obj ) (((vlc_object_internals_t*)(VLC_OBJECT(obj)))-1)
+# define vlc_internals(o) ((o)->obj.priv)
# define vlc_externals( priv ) ((vlc_object_t *)((priv) + 1))
extern void var_DestroyAll( vlc_object_t * );
More information about the vlc-commits
mailing list