Commit bf8c6207 authored by Martin Storsjo's avatar Martin Storsjo

halloc: Cast the offsetof macro to ptrdiff_t before negating

This gets rid of the warning
"C4146: unary minus applied to unsigned type, result still unsigned"
with visual c++.

Change-Id: I6eb24da983136d798221db4d3a5f50dc2857a03b
parent ec34afd1
......@@ -20,7 +20,7 @@
/*
restore pointer to the structure by a pointer to its field
*/
#define structof(p,t,f) ((t*)(- offsetof(t,f) + (char*)(p)))
#define structof(p,t,f) ((t*)(- (ptrdiff_t) offsetof(t,f) + (char*)(p)))
/*
* redefine for the target compiler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment