[libvirt] [PATCH 17/41] cpu: Special case models == NULL in cpuGetModels

Jiri Denemark jdenemar at redhat.com
Wed Sep 14 09:17:07 UTC 2016


On Mon, Aug 29, 2016 at 17:59:21 -0400, John Ferlan wrote:
...
> > @@ -1127,9 +1127,13 @@ cmdCPUModelNames(vshControl *ctl, const vshCmd *cmd)
> >          return false;
> >      }
> >  
> > -    for (i = 0; i < nmodels; i++) {
> > -        vshPrint(ctl, "%s\n", models[i]);
> > -        VIR_FREE(models[i]);
> > +    if (nmodels == 0) {
> > +        vshPrint(ctl, "%s\n", _("all CPU models are accepted"));
> > +    } else {
> > +        for (i = 0; i < nmodels; i++) {
> > +            vshPrint(ctl, "%s\n", models[i]);
> > +            VIR_FREE(models[i]);
> > +        }
> 
> I seem to recall some recent work around the -q[uiet] switch - is that
> something that this code needs to be concerned with?  (as silly as that
> seems while I'm typing it!)

Not silly at all. I replaced vshPrint with vshPrintExtra.

Jirka




More information about the libvir-list mailing list