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

Re: [libvirt] [PATCH 06/13] Turn virDomainObjPtr into a virObjectPtr



>  void
>  virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights,
>                                 int ndevices)
> @@ -723,7 +738,7 @@ virDomainObjListDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
>  {
>      virDomainObjPtr obj = payload;
>      virDomainObjLock(obj);
> -    if (virDomainObjUnref(obj) > 0)
> +    if (!virObjectUnref(obj))
>          virDomainObjUnlock(obj);
>  }

I suppose you mean

       if (virObjectUnref(obj))

here.

But, I can't see any reason to lock then unref then unlock, just unref
is enough.

BTW, if containers, like virHashTable, support only virObject, then the
free callback, say virHashDataFree, can be to simply unref the
virObject.

-- 
Thanks,
Hu Tao


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