[vlc-devel] [PATCH] variables: simplify the access to/from vlc_object_t and vlc_object_internals_t

Rémi Denis-Courmont remi at remlab.net
Wed Jul 26 11:53:35 CEST 2017


Le 26 juillet 2017 12:05:08 GMT+03:00, Steve Lhomme <robux4 at videolabs.io> a écrit :
>Since we assume obj = priv + 1 that means we assume the offset between
>the 2
>structures is always sizeof(vlc_object_internals_t).
>---
> src/misc/variables.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/src/misc/variables.h b/src/misc/variables.h
>index bab14c8567..4b925848a1 100644
>--- a/src/misc/variables.h
>+++ b/src/misc/variables.h
>@@ -58,9 +58,9 @@ struct vlc_object_internals
>     max_align_t aligned_end[];
> };
> 
>-# define vlc_internals(obj) \
>-    container_of(VLC_OBJECT(obj), struct vlc_object_internals,
>aligned_end)
>-# define vlc_externals(priv ) ((vlc_object_t *)((priv)->aligned_end))
>+# define vlc_internals(obj)  (((vlc_object_internals_t*) obj) - 1)
>+# define vlc_externals(priv) \
>+    ((vlc_object_t *)(((vlc_object_internals_t*) priv) + 1))
> 
> void DumpVariables(vlc_object_t *obj);
> 
>-- 
>2.12.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

Looks ok
-- 
Rémi Denis-Courmont
Typed on an inconvenient virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170726/b1b00f5c/attachment.html>


More information about the vlc-devel mailing list