From 1bbef4be743d32fb8ee300d11eef55eaea51bb1a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 10 Sep 2015 21:27:14 +0900 Subject: [PATCH] Avoid usage of typeof and replace __builtin_offsetof with offsetof --- lib/nghttp2_helper.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/nghttp2_helper.h b/lib/nghttp2_helper.h index 979b64af..89631823 100644 --- a/lib/nghttp2_helper.h +++ b/lib/nghttp2_helper.h @@ -40,11 +40,8 @@ #define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0) -#define nghttp2_struct_of(ptr, type, member) \ - ({ \ - const typeof(((type *)0)->member) *nghttp2__mptr = (ptr); \ - (type *)(void *)((char *)nghttp2__mptr - __builtin_offsetof(type, member)); \ - }) +#define nghttp2_struct_of(ptr, type, member) \ + ((type *)(void *)((char *)(ptr) - offsetof(type, member))) /* * Copies 2 byte unsigned integer |n| in host byte order to |buf| in