uci: silence UBSAN error by using offsetof macro from compiler
[project/uci.git] / uci.h
diff --git a/uci.h b/uci.h
index 43f2052a00e6901e67cd6d1956fdb36375b41358..b385e2be964fc4a891833ede584fba6c8fa208cb 100644 (file)
--- a/uci.h
+++ b/uci.h
@@ -34,6 +34,7 @@ extern "C" {
 #include <setjmp.h>
 #include <stdio.h>
 #include <stdint.h>
+#include <stddef.h>
 
 #define UCI_CONFDIR "/etc/config"
 #define UCI_SAVEDIR "/tmp/.uci"
@@ -509,11 +510,6 @@ struct uci_parse_option {
 };
 
 
-/* linked list handling */
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
 /**
  * container_of - cast a member of a structure out to the containing structure
  * @ptr:    the pointer to the member.