Re: [PATCH 4/4] virFree: Check const correctness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/15/2014 07:46 AM, Eric Blake wrote:

> But if you take my suggestion in 2/4 about merely removing the
> 'cast-away-const' while still keeping type safety, then a
> single-argument virFree() should still be noisy on attempts to VIR_FREE
> a const pointer.
> 
> 
>> @@ -543,11 +543,23 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
>>   * @ptr: pointer holding address to be freed
>>   *
>>   * Free the memory stored in 'ptr' and update to point
>> - * to NULL.
>> + * to NULL. Moreover, this macro has a side effect in
>> + * form of evaluating passed argument multiple times.
> 
> NACK.  I think it is possible to use sizeof() to come up with a
> construct that will only do side effects once, rather than having to
> weaken the guarantee of VIR_FREE.  Please give me some time to propose
> an alternative.

I didn't even need to resort to sizeof().  Here's v2, which replaces 2,
3, and 4 of this series:

https://www.redhat.com/archives/libvir-list/2014-July/msg00760.html

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]