[PATCH 01/36] util: virresctrl: convert classes to GObject

Peter Krempa pkrempa at redhat.com
Fri Apr 3 15:37:06 UTC 2020


On Fri, Apr 03, 2020 at 17:15:29 +0200, Rafael Fonseca wrote:
> Signed-off-by: Rafael Fonseca <r4f4rfs at gmail.com>
> ---
>  src/conf/capabilities.c |   3 +-
>  src/conf/domain_conf.c  |  21 +++---
>  src/util/virresctrl.c   | 137 ++++++++++++++++++++++------------------
>  src/util/virresctrl.h   |  15 +++--
>  tests/virresctrltest.c  |   3 +-
>  5 files changed, 97 insertions(+), 82 deletions(-)
> 
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index 99b69aebb5..2c91461a54 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -266,7 +266,8 @@ virCapsDispose(void *object)
>      VIR_FREE(caps->host.netprefix);
>      VIR_FREE(caps->host.pagesSize);
>      virCPUDefFree(caps->host.cpu);
> -    virObjectUnref(caps->host.resctrl);
> +    if (caps->host.resctrl)
> +        g_object_unref(caps->host.resctrl);

Please use g_clear_object without the condition instead of this pattern
everywhere. It was recently discussed on the list that this is the
better option.




More information about the libvir-list mailing list