mirror of
https://github.com/Genymobile/scrcpy
synced 2025-09-01 06:45:40 +00:00
Add container_of() macro
This will allow to get the parent of an embedded struct.
This commit is contained in:
@@ -8,4 +8,7 @@
|
|||||||
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
|
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
|
||||||
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
|
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
|
||||||
|
|
||||||
|
#define container_of(ptr, type, member) \
|
||||||
|
((type *) (((char *) (ptr)) - offsetof(type, member)))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user