On 02/18/2011 12:30 PM, Jim Meyering wrote:
>>> -    if (doms->objs)
>>> -        virHashFree(doms->objs, virDomainObjListDeallocator);
>>> +    virHashFree(doms->objs, virDomainObjListDeallocator);
>>
>> I tried adding --name=virHashFree to the useless_free_options variable
>> in cfg.mk, to see if that would prevent regressions.  However, it
>> appears that this two-argument free-like function is not picked up by
>> the heuristics in the useless-if-before-free script (it only works on
>> one-argument functions).

> Right.  useless-if-before-free deliberately detects only
> one-argument free-like functions.

An even better idea - as long as we're improving hash.h, why not fix
things to pass the destructor in the Create call, rather than the Free
call.  Then freeing is a one-argument operation, using the destructor
callback registered inside the virHash object, rather than a
two-argument operation requiring the caller to pass in the destructor.
At which point, we've defined away the problem of useless-if-before-free.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to