COM implementation clean up

Michael Stefaniuc mstefani at redhat.com
Wed Nov 24 03:41:49 CST 2010


Hello,

Alexander Kochetkov wrote:
> The code like
> static inline MyObject *impl_from_IMyInterface(IMyInterface *iface)
> {
>     return (MyObject*)((char*)iface - FIELD_OFFSET(MyObject,
> IMyInterface_iface));
> }
> 
> could be replaced with
> static inline MyObject *impl_from_IMyInterface(IMyInterface *iface)
> {
>     return container_of(MyObject, IMyInterface_iface);
> }
container_of is Linux Kernel specific. But Windows has such a macro too
called CONTAINING_RECORD().

bye
	michael



More information about the wine-devel mailing list