[libvirt] [RFC PATCH] qemumonitorjsontest: Use VIR_AUTOPTR for test cleanup

Peter Krempa pkrempa at redhat.com
Tue Jun 11 07:20:22 UTC 2019


On Mon, Jun 10, 2019 at 22:03:05 -0500, Eric Blake wrote:
> Everywhere else is switching, we might as well use it here, too.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> 
> ---
> 
> Partial patch - is it worth me continuing the cleanups on the rest of
> the file?

ACK to this one if you split it, but I'm unsure whether it's worth
investing time into converting all of the tests. Definitely the
definition of the AUTOPTR function is worth because new tests can use
the new format.

> ---
>  tests/qemumonitortestutils.h |  3 +++
>  tests/qemumonitorjsontest.c  | 35 +++++++++++++++--------------------
>  2 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h
> index 8461c80caa..a2d2d30820 100644
> --- a/tests/qemumonitortestutils.h
> +++ b/tests/qemumonitortestutils.h
> @@ -24,6 +24,7 @@
>  # include "qemu/qemu_conf.h"
>  # include "qemu/qemu_monitor.h"
>  # include "qemu/qemu_agent.h"
> +# include "virautoclean.h"
> 
>  typedef struct _qemuMonitorTest qemuMonitorTest;
>  typedef qemuMonitorTest *qemuMonitorTestPtr;
> @@ -102,4 +103,6 @@ qemuMonitorPtr qemuMonitorTestGetMonitor(qemuMonitorTestPtr test);
>  qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test);
>  virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test);
> 
> +VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorTest, qemuMonitorTestFree);

Possibly add this in a separate patch?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190611/9f3e0c1e/attachment-0001.sig>


More information about the libvir-list mailing list