diff --git a/include/haproxy/compiler.h b/include/haproxy/compiler.h index 80d9be772..01a1a62e7 100644 --- a/include/haproxy/compiler.h +++ b/include/haproxy/compiler.h @@ -350,7 +350,7 @@ * which has its member stored at address . */ #ifndef container_of -#define container_of(ptr, type, name) ((type *)(((void *)(ptr)) - ((long)&((type *)0)->name))) +#define container_of(ptr, type, name) ((type *)(((char *)(ptr)) - ((long)&((type *)0)->name))) #endif /* returns a pointer to the structure of type which has its member @@ -359,7 +359,7 @@ #ifndef container_of_safe #define container_of_safe(ptr, type, name) \ ({ void *__p = (ptr); \ - __p ? (type *)(__p - ((long)&((type *)0)->name)) : (type *)0; \ + __p ? (type *)((char *)__p - ((long)&((type *)0)->name)) : (type *)0; \ }) #endif