Re: [PATCH 4/8] tests: Use virAsprintf() to build titles

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

 



On Thu, Mar 07, 2019 at 16:44:33 +0100, Andrea Bolognani wrote:
> We're using static string concatenation at the moment, but
> that will no longer be a possibility in a bit.
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  tests/qemucapabilitiestest.c | 11 ++++++++---
>  tests/qemucaps2xmltest.c     | 13 +++++++++----
>  2 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
> index e3c6681dd4..222ac05d79 100644
> --- a/tests/qemucapabilitiestest.c
> +++ b/tests/qemucapabilitiestest.c
> @@ -196,12 +196,17 @@ mymain(void)
>  
>  #define DO_TEST(arch, name) \
>      do { \
> +        VIR_AUTOFREE(char *) title = NULL; \
> +        VIR_AUTOFREE(char *) copyTitle = NULL; \
> +        if (virAsprintf(&title, "%s (%s)", name, arch) < 0 || \
> +            virAsprintf(&copyTitle, "copy %s (%s)", name, arch) < 0) { \
> +            return -EXIT_FAILURE; \

Coding style. Single-line body.

> +        } \
>          data.archName = arch; \
>          data.base = name; \
> -        if (virTestRun(name "(" arch ")", testQemuCaps, &data) < 0) \
> +        if (virTestRun(title, testQemuCaps, &data) < 0) \
>              data.ret = -1; \
> -        if (virTestRun("copy " name "(" arch ")", \
> -                       testQemuCapsCopy, &data) < 0) \
> +        if (virTestRun(copyTitle, testQemuCapsCopy, &data) < 0) \
>              data.ret = -1; \
>      } while (0)

ACK

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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