Re: [libvirt PATCH v3 4/6] qemu: inline the qemuBuildCpuFeature code

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

 



On Fri, Oct 08, 2021 at 10:01:43 +0100, Daniel P. Berrangé wrote:
> With the previous refactorings, there's no real benefit from the
> qemuBuildCpuFeature helper method. Only one of the callers really
> needs the CPU feature name re-writing logic, the others can just
> use the right name directly.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  src/qemu/qemu_command.c | 31 +++++++++++--------------------
>  1 file changed, 11 insertions(+), 20 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 92125dbc85..f24c8842aa 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6292,18 +6292,6 @@ qemuBuildGlobalControllerCommandLine(virCommand *cmd,
>  }
>  
>  
> -static void
> -qemuBuildCpuFeature(virQEMUCaps *qemuCaps,
> -                    virBuffer *buf,
> -                    const char *name,
> -                    bool state)
> -{
> -    name = virQEMUCapsCPUFeatureToQEMU(qemuCaps, name);
> -
> -    virBufferAsprintf(buf, ",%s=%s", name, state ? "on" : "off");
> -}
> -
> -
>  static int
>  qemuBuildCpuModelArgStr(virQEMUDriver *driver,
>                          const virDomainDef *def,
> @@ -6376,15 +6364,17 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver,
>          virBufferAsprintf(buf, ",vendor=%s", cpu->vendor_id);
>  
>      for (i = 0; i < cpu->nfeatures; i++) {
> +        const char *featname = virQEMUCapsCPUFeatureToQEMU(
> +            qemuCaps, cpu->features[i].name);

That's not really the kind of formatting we use in libvirt. This looks
more like go :-)

Either
           const char *featname = virQEMUCapsCPUFeatureToQEMU(qemuCaps,
                                                              cpu->features[i].name);

or just put the all on a single line.

Anyway, nicely separated patch which makes it obvious removing the
function did not have unexpected side effects.

Reviewed-by: Jiri Denemark <jdenemar@xxxxxxxxxx>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux