[vlc-devel] [PATCH] variables: simplify the access to/from vlc_object_t and vlc_object_internals_t
Steve Lhomme
robux4 at videolabs.io
Wed Jul 26 17:27:07 CEST 2017
From: Steve Lhomme <robUx4 at videolabs.io>
Since we assume obj = priv + 1 that means we assume the offset between the 2
structures is always sizeof(vlc_object_internals_t).
--
replaces https://patches.videolan.org/patch/17644/
- more parenthesis
https://patches.videolan.org/patch/17643/
- not needed anymore
---
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..f477a309c7 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
More information about the vlc-devel
mailing list