diff --git a/contrib/spoa_example/include/mini-clist.h b/contrib/spoa_example/include/mini-clist.h index a89255c46..d009704cc 100644 --- a/contrib/spoa_example/include/mini-clist.h +++ b/contrib/spoa_example/include/mini-clist.h @@ -44,7 +44,7 @@ struct list { * since it's used only once. * Example: LIST_ELEM(cur_node->args.next, struct node *, args) */ -#define LIST_ELEM(lh, pt, el) ((pt)(((void *)(lh)) - ((void *)&((pt)NULL)->el))) +#define LIST_ELEM(lh, pt, el) ((pt)(((const char *)(lh)) - ((size_t)&((pt)NULL)->el))) /* checks if the list head is empty or not */ #define LIST_ISEMPTY(lh) ((lh)->n == (lh)) diff --git a/include/common/mini-clist.h b/include/common/mini-clist.h index 9736d13ea..f18e3f072 100644 --- a/include/common/mini-clist.h +++ b/include/common/mini-clist.h @@ -137,7 +137,7 @@ struct cond_wordlist { * since it's used only once. * Example: LIST_ELEM(cur_node->args.next, struct node *, args) */ -#define LIST_ELEM(lh, pt, el) ((pt)(((void *)(lh)) - ((void *)&((pt)NULL)->el))) +#define LIST_ELEM(lh, pt, el) ((pt)(((const char *)(lh)) - ((size_t)&((pt)NULL)->el))) /* checks if the list head is empty or not */ #define LIST_ISEMPTY(lh) ((lh)->n == (lh)) @@ -457,7 +457,7 @@ struct cond_wordlist { * since it's used only once. * Example: MT_LIST_ELEM(cur_node->args.next, struct node *, args) */ -#define MT_LIST_ELEM(lh, pt, el) ((pt)(((void *)(lh)) - ((void *)&((pt)NULL)->el))) +#define MT_LIST_ELEM(lh, pt, el) ((pt)(((const char *)(lh)) - ((size_t)&((pt)NULL)->el))) /* checks if the list head is empty or not */ #define MT_LIST_ISEMPTY(lh) ((lh)->next == (lh))