Mercurial > MadButterfly
diff src/tools.h @ 93:c3c41f88e776
-
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 24 Aug 2008 01:18:58 +0800 |
parents | 9ab15ebc9061 |
children | ca94493b75bb |
line wrap: on
line diff
--- a/src/tools.h Sun Aug 24 00:18:59 2008 +0800 +++ b/src/tools.h Sun Aug 24 01:18:58 2008 +0800 @@ -45,7 +45,7 @@ (elm)->field = follow; \ } while(0) #define STAILQ_REMOVE(q, type, field, elm) \ - do { \ +~ do { \ if((elm) == (q).head) { \ (q).head = (elm)->field; \ if((q).head == NULL) \ @@ -68,5 +68,6 @@ #define OFFSET(type, mem) (((void *)&((type *)NULL)->mem) - NULL) #define MEM2OBJ(var, type, mem) ((type *)((void *)var - OFFSET(type, mem))) +#define OFF2TYPE(obj, off, type) (*(type *)((void *)(obj) + (off))) #endif /* __TOOLS_H_ */