virobject: Check if @parent is the first member in class

Our virObject code relies heavily on the fact that the first
member of the class struct is type of virObject (or some
derivation of if). Let's check for that.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 10f94828
无相关合并请求
......@@ -76,7 +76,8 @@ virClassPtr virClassForObjectRWLockable(void);
# endif
# define VIR_CLASS_NEW(name, prnt) \
(name##Class = virClassNew(prnt, #name, sizeof(name), name##Dispose))
verify_expr(offsetof(name, parent) == 0, \
(name##Class = virClassNew(prnt, #name, sizeof(name), name##Dispose)))
virClassPtr
virClassNew(virClassPtr parent,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部