Re: [PATCH v2 1/6] tests: qemuxml2xml: Set name in testQemuInfo

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

 



On Mon, 2019-04-15 at 19:09 -0400, Cole Robinson wrote:
[...]
> @@ -148,7 +146,6 @@ mymain(void)
>  {
>      int ret = 0;
>      char *fakerootdir;
> -    struct testQemuInfo info;
>      virQEMUDriverConfigPtr cfg = NULL;
>      virHashTablePtr capslatest = NULL;
>  
> @@ -168,39 +165,40 @@ mymain(void)
>  
>      setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1);
>  
> -    memset(&info, 0, sizeof(info));
> -
>      if (qemuTestDriverInit(&driver) < 0)
>          return EXIT_FAILURE;
>  
>      cfg = virQEMUDriverGetConfig(&driver);
>  
> -# define DO_TEST_FULL(name, when, ...) \
> +# define DO_TEST_FULL(_name, when, ...) \
>      do { \
> +        static struct testQemuInfo info = { \
> +            .name = _name, \
> +        }; \

Since we're calling testQemuInfoClear() at the end of the macro
already, we could probably avoid creating a new structure every
single time and reuse the same one over and over again, as this test
was doing. But we can do that in a later patch, and now that the
code is identical between xml2argv and xml2xml it's gonna be easier
to change both at the same time.

Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx>

-- 
Andrea Bolognani / Red Hat / Virtualization

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