2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-08-30 13:58:08 +00:00

Add container_of() macro

This will allow to get the parent of an embedded struct.
This commit is contained in:
Romain Vimont
2021-04-11 15:01:05 +02:00
parent 2ddf760c09
commit 08f1fd46c8

View File

@@ -8,4 +8,7 @@
#define MIN(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