[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Properly advertise cpuselection guest capability



> >      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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]