[libvirt] [PATCH] Properly advertise cpuselection guest capability
Jiri Denemark
jdenemar at redhat.com
Wed Apr 7 09:29:07 UTC 2010
> > guest->arch.defaultInfo.emulator_mtime = binary_mtime;
> >
> > - if (qemudProbeCPUModels(binary, info->arch, &ncpus, NULL) == 0
> > + if (caps->host.cpu
> > + && qemudProbeCPUModels(binary, info->arch, &ncpus, NULL) == 0
> > && ncpus > 0
> > && !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
> > goto error;
>
> We usually put && on end of line,
Yeah, usually, although not always :-) I prefer it this way as you don't have
to look at the end of line to check if that line is part of the condition or
not. But I don't really care too much and I can change it.
> and I really prefer fully parenthesized tests expressions
Hmm, I don't :-) Because you can see the difference if you mistakenly type =
instead of == there (well, not in this exact case, but in general):
if (x = 0) vs. if ((x = 0))
In the first case gcc would warn you but in the second one it wouldn't. So I
prefer extra parentheses to be put only around assignments not tests to reveal
this kind of typos.
Jirka
More information about the libvir-list
mailing list