[adding Jim to cc, as author of useless-if-before-free] On 02/17/2011 02:14 PM, Christophe Fergeau wrote: > virHashFree follows the convention described in HACKING that > XXXFree() functions can be called with a NULL argument. > --- > src/conf/domain_conf.c | 6 +--- > src/datatypes.c | 51 +++++++++++++++------------------------------- > src/qemu/qemu_process.c | 4 +-- > 3 files changed, 20 insertions(+), 41 deletions(-) > > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index 351daf7..e7c3409 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -410,8 +410,7 @@ static void virDomainObjListDeallocator(void *payload, const char *name ATTRIBUT > > void virDomainObjListDeinit(virDomainObjListPtr doms) > { > - 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). ACK to your patch as-is, so I pushed it. But I can't help but wonder if we could make this easier to enforce at 'make syntax-check' time by tweaking the perl script somehow. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 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