[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 16:50:51 CEST 2017
Le keskiviikkona 26. heinäkuuta 2017, 12.53.35 EEST Rémi Denis-Courmont a
écrit :
> 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);
>
> Looks ok
I take that back. It´s not expansion-safe.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list