[libvirt] [PATCH v2 1/4] test_driver: introduce TEST_SET_PARAM macro

Ilias Stamatis posted 4 patches 5 years, 4 months ago
[libvirt] [PATCH v2 1/4] test_driver: introduce TEST_SET_PARAM macro
Posted by Ilias Stamatis 5 years, 4 months ago
This macro can be used by most or all of the DomainGetXXXParameters APIs.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
---
 src/test/test_driver.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 4b1f2724a0..c0608a4bea 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2844,6 +2844,16 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     return ret;
 }

+
+#define TEST_SET_PARAM(index, name, type, value) \
+    if (index < *nparams && \
+        virTypedParameterAssign(&params[index], name, type, value) < 0) \
+        goto cleanup
+
+
+#undef TEST_SET_PARAM
+
+
 static int testConnectNumOfDefinedDomains(virConnectPtr conn)
 {
     testDriverPtr privconn = conn->privateData;
--
2.22.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 1/4] test_driver: introduce TEST_SET_PARAM macro
Posted by Erik Skultety 5 years, 4 months ago
On Tue, Jul 02, 2019 at 03:49:41PM +0200, Ilias Stamatis wrote:
> This macro can be used by most or all of the DomainGetXXXParameters APIs.

Technically okay, but usually we introduce such helper macros with the first
function that needs it, solely because a patch such as this is effectively a
NOP wit the #undef, so I'll squash this patch into 2/4.

Reviewed-by: Erik Skultety <eskultet@redhat.com>

>
> Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> ---
>  src/test/test_driver.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 4b1f2724a0..c0608a4bea 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -2844,6 +2844,16 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
>      return ret;
>  }
>
> +
> +#define TEST_SET_PARAM(index, name, type, value) \
> +    if (index < *nparams && \
> +        virTypedParameterAssign(&params[index], name, type, value) < 0) \
> +        goto cleanup
> +
> +
> +#undef TEST_SET_PARAM
> +
> +
>  static int testConnectNumOfDefinedDomains(virConnectPtr conn)
>  {
>      testDriverPtr privconn = conn->privateData;
> --
> 2.22.0
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

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