mirror of
https://github.com/libretro/libretro-tyrquake.git
synced 2025-02-21 16:30:44 +00:00
common: STRUCT_FROM_LINK is just container_of()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
0d9124f631
commit
6904db836d
@ -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
|
||||
|
@ -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)
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user