On 18/07/18 15:30, Jan Beulich wrote:
>>> --- a/xen/include/xen/xmalloc.h
>>> +++ b/xen/include/xen/xmalloc.h
>>> @@ -42,6 +42,12 @@
>>>  /* Free any of the above. */
>>>  extern void xfree(void *);
>>>  
>>> +/* Free an allocation, and zero the pointer to it. */
>>> +#define XFREE(p) do { \
>>> +    xfree(p);         \
>>> +    (p) = NULL;       \
>>> +} while ( false )
>> Do you need the do { ... } while construct here? Isn't it enough to
>> use ({ ... })?
> I try to avoid gcc extensions when the same can be achieved without.
> Furthermore I'd prefer if the construct was not usable as rvalue.

Yes - the do { } while ( 0 ) style here is actually more useful than ({
}) to prevent caller (mis)use.

~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to