Module: kamailio Branch: master Commit: ad2e976d9200bd68c88e4a78edc0d250ba4045ba URL: https://github.com/kamailio/kamailio/commit/ad2e976d9200bd68c88e4a78edc0d250...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2023-12-11T11:31:56+01:00
core: helper macro to get enclosing struture from a member address
---
Modified: src/core/ut.h
---
Diff: https://github.com/kamailio/kamailio/commit/ad2e976d9200bd68c88e4a78edc0d250... Patch: https://github.com/kamailio/kamailio/commit/ad2e976d9200bd68c88e4a78edc0d250...
---
diff --git a/src/core/ut.h b/src/core/ut.h index 8e2e4f0d8f0..ff8d964e559 100644 --- a/src/core/ut.h +++ b/src/core/ut.h @@ -33,6 +33,7 @@ #include <limits.h> #include <time.h> #include <unistd.h> +#include <stddef.h> #include <ctype.h> #include <string.h> #include <strings.h> @@ -143,6 +144,8 @@
#define is_in_str(p, in) (p < in->s + in->len && *p)
+#define ksr_container_of(ptr, type, member) \ + ((type *)((char *)(ptr)-offsetof(type, member)))
/* links a value to a msgid */ struct msgid_var