Re: [libvirt PATCH v2 04/16] util: Allow virFileCache data to be any GObject

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

 



On Wed, Aug 31, 2022 at 13:40:49 -0500, Jonathon Jongsma wrote:
> Since the libvirt documentation suggests to prefer GObject over
> virObject, and since virObject is a GObject, change virFileCache to
> allow GObjects as data.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> ---
>  src/util/virfilecache.c | 15 +++++++++------
>  src/util/virfilecache.h |  2 +-
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c
> index bad37c9f00..e37008990d 100644
> --- a/src/util/virfilecache.c
> +++ b/src/util/virfilecache.c
> @@ -170,7 +170,8 @@ virFileCacheLoad(virFileCache *cache,
>      *data = g_steal_pointer(&loadData);
>  
>   cleanup:
> -    virObjectUnref(loadData);
> +    if (loadData)
> +        g_object_unref(loadData);

Please replace these with g_clear_pointer(&loadData, g_object_unref) to
avoid the extra if .




[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