[Libsysio-commit] HEAD: libsysio/include sysio-cmn.h
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-09-21 19:37:03
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv355/include Modified Files: sysio-cmn.h Log Message: Oops. Need to add changes supporting CONTAINER macro for the new tree abstraction support. Index: sysio-cmn.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/sysio-cmn.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- sysio-cmn.h 20 Aug 2007 19:12:08 -0000 1.18 +++ sysio-cmn.h 21 Sep 2007 19:36:59 -0000 1.19 @@ -83,6 +83,18 @@ struct intnl_xtvec; struct iovec; /* + * Return offset to given member of given structure or union. + */ +#define OFFSETOF(type, _mbr) \ + ((size_t )&((struct type *)0)->_mbr) + +/* + * Return ptr to record containing the passed member. + */ +#define CONTAINER(type, _mbr, ptr) \ + (struct type *)((ptrdiff_t )(ptr) - OFFSETOF(type, _mbr)) + +/* * Symbol composition. */ #define _PREPEND_HELPER(p, x) \ |