common: STRUCT_FROM_LINK is just container_of()

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2012-10-25 14:18:52 +10:30
parent 0d9124f631
commit 6904db836d
4 changed files with 2 additions and 12 deletions

View File

@ -62,11 +62,6 @@ void RemoveLink(link_t *l);
void InsertLinkBefore(link_t *l, link_t *before);
void InsertLinkAfter(link_t *l, link_t *after);
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (unsigned long)&(((t *)0)->m)))
//============================================================================
#ifndef NULL

View File

@ -49,7 +49,7 @@ typedef struct edict_s {
// other fields from progs come immediately after
} edict_t;
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
#define EDICT_FROM_AREA(l) container_of(l,edict_t,area)
//============================================================================

View File

@ -63,11 +63,6 @@ void RemoveLink(link_t *l);
void InsertLinkBefore(link_t *l, link_t *before);
void InsertLinkAfter(link_t *l, link_t *after);
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (unsigned long)&(((t *)0)->m)))
//============================================================================
#ifndef NULL

View File

@ -54,7 +54,7 @@ typedef struct edict_s {
// other fields from progs come immediately after
} edict_t;
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
#define EDICT_FROM_AREA(l) container_of(l,edict_t,area)
//============================================================================