[libvirt] [PATCH 66/75] tools: Use g_strdup_printf() instead of virAsprintf()

Daniel Henrique Barboza danielhb413 at gmail.com
Thu Oct 24 16:10:12 UTC 2019



On 10/22/19 10:58 AM, Michal Privoznik wrote:
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>   tools/virsh-completer-domain.c |  6 +++---
>   tools/virsh-completer-host.c   | 10 +++++-----
>   tools/virsh-completer.c        |  2 +-
>   tools/virsh-domain-monitor.c   | 18 +++++++++---------
>   tools/virsh-domain.c           | 22 +++++++++++-----------
>   tools/virsh-host.c             |  2 +-
>   tools/virsh-interface.c        |  2 +-
>   tools/virsh-network.c          |  2 +-
>   tools/virsh-pool.c             | 12 ++++++------
>   tools/virsh-volume.c           |  6 +++---
>   tools/virt-admin.c             |  4 ++--
>   tools/vsh.c                    | 22 +++++++++++-----------
>   12 files changed, 54 insertions(+), 54 deletions(-)
> 
> diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
> index 0bf6202c0a..d625ab8bb4 100644
> --- a/tools/virsh-completer-domain.c
> +++ b/tools/virsh-completer-domain.c
> @@ -221,9 +221,9 @@ virshDomainInterfaceStateCompleter(vshControl *ctl,
>       if (virMacAddrParse(iface, &macaddr) == 0)
>           virMacAddrFormat(&macaddr, macstr);
>   
> -    virAsprintf(&xpath, "/domain/devices/interface[(mac/@address = '%s') or "
> -                "                          (target/@dev = '%s')]", macstr,
> -                iface);
> +    xpath = g_strdup_printf("/domain/devices/interface[(mac/@address = '%s') or "
> +                            "                          (target/@dev = '%s')]", macstr,
> +                            iface);
>   
>       if ((ninterfaces = virXPathNodeSet(xpath, ctxt, &interfaces)) < 0)
>           return NULL;
> diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c
> index 8cb98ad88d..41615226d2 100644
> --- a/tools/virsh-completer-host.c
> +++ b/tools/virsh-completer-host.c
> @@ -44,7 +44,7 @@ virshPagesizeNodeToString(xmlNodePtr node)
>       if (virScaleInteger(&byteval, unit, 1024, UINT_MAX) < 0)
>           return NULL;
>       size = vshPrettyCapacity(byteval, &suffix);
> -    virAsprintf(&ret, "%.0f%s", size, suffix);
> +    ret = g_strdup_printf("%.0f%s", size, suffix);
>       return ret;
>   }
>   
> @@ -78,11 +78,11 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl,
>           return NULL;
>   
>       if (cellno && vshCommandOptStringQuiet(ctl, cmd, "cellno", &cellnum) > 0) {
> -        virAsprintf(&path,
> -                    "/capabilities/host/topology/cells/cell[@id=\"%s\"]/pages",
> -                    cellnum);
> +        path = g_strdup_printf(
> +                               "/capabilities/host/topology/cells/cell[@id=\"%s\"]/pages",
> +                               cellnum);


Extra newline after the '('.



Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>




More information about the libvir-list mailing list