On Fri, Feb 18, 2011 at 01:22:41PM -0700, Eric Blake wrote: > 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. Yes, that makes alot more sense as an API design Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list