[vlc-devel] [PATCH] objects: get the vlc_object_t from vlc_object_internals using vlc_internals()

Steve Lhomme robux4 at videolabs.io
Tue Jul 25 18:06:32 CEST 2017


So that's it coherent with the rest of the usages.

Incidentally I came into this because on some other compilers vlc_internals()
returns the position of aligned_end and not the end of the vlc_object_internals
structure. Giving a mismatch between the position of vlc_object_t in all calls
using vlc_internals() whearas in this function it assumes obj is after the end
of the vlc_object_internals_t structure.
---
 src/misc/objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index c8fcccc9af..91eebdaf20 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -201,7 +201,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
     vlc_mutex_init (&priv->tree_lock);
     priv->resources = NULL;
 
-    vlc_object_t *obj = (vlc_object_t *)(priv + 1);
+    vlc_object_t *obj = vlc_externals(priv);
     obj->obj.object_type = typename;
     obj->obj.header = NULL;
     obj->obj.force = false;
-- 
2.12.1



More information about the vlc-devel mailing list