On Tue, Oct 10, 2017 at 05:05:33PM +0200, Andrea Bolognani wrote: > On Tue, 2017-10-10 at 15:49 +0100, Daniel P. Berrange wrote: > > I think rather than trying to fix up the assumption about > > machine being non-NULL, we should restructure the ARGV > > parsing into we need a 2 pass process. > > > > In the first pass only look for the -machine arg. If no > > -machine arg is given, we should fill in the default machine > > for that emulator. > > I can do this... > > > In the second pass process the rest of the ARGV, whereupon > > we have a valid assumption that machine is non-NULL. > > ... but I'm not sure doing this is a good idea. > > Wouldn't it be much safer to leave the newly-added NULL checks > in place so that the qemuDomainMachineIs*() functions are locally > correct instead of relying on external guarantees in order not > to crash on the user? Are these qemuDomainMachineIs* functions the only places that makes assumptions about machine being non-NULL though ? I wouldn't want to encourage the idea that it is OK to have a NULL machine value, because that would just push crashes to elsewhere in the code if people rely on it. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list