Browse code

core:sr_module If offsetof is not found in stddef.h define it as a macro

This is very unlikely; the macro uses the null pointer dereference

Marius Zbihlei authored on 17/08/2010 08:24:43
Showing 1 changed files
... ...
@@ -101,11 +101,15 @@ struct sr_module* modules=0;
101 101
 	extern struct module_exports sl_exports;
102 102
 #endif
103 103
 
104
+#ifndef offsetof
105
+#warning "use null pointer dereference for offsetof"
106
+#define offsetof(st, m) \
107
+		((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
108
+#endif
104 109
 
105 110
 int mod_response_cbk_no=0;
106 111
 response_function* mod_response_cbks=0;
107 112
 
108
-
109 113
 /* initializes statically built (compiled in) modules*/
110 114
 int register_builtin_modules()
111 115
 {