[libvirt] [PATCH 8/8] interface: Introduce virInterfaceObjNew

Michal Privoznik mprivozn at redhat.com
Fri May 19 15:29:15 UTC 2017


On 04/26/2017 12:36 AM, John Ferlan wrote:
> Create/use a helper to perform the object allocation
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/virinterfaceobj.c | 31 +++++++++++++++++++++++--------
>  1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c
> index 1cc5c92..4463653 100644
> --- a/src/conf/virinterfaceobj.c
> +++ b/src/conf/virinterfaceobj.c
> @@ -46,6 +46,27 @@ struct _virInterfaceObjList {
>  
>  /* virInterfaceObj manipulation */
>  
> +static virInterfaceObjPtr
> +virInterfaceObjNew(void)
> +{
> +    virInterfaceObjPtr obj;
> +
> +    if (VIR_ALLOC(obj) < 0)
> +        return NULL;
> +
> +    if (virMutexInit(&obj->lock) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "%s", _("cannot initialize mutex"));
> +        VIR_FREE(obj);
> +        return NULL;
> +    }
> +
> +    virInterfaceObjLock(obj);
> +
> +    return obj;
> +}
> +
> +


Any reason why virInterfaceObj can't actually be an virObject?
virInterfaceObjLock() is so 0.9.X release-y.

Michal




More information about the libvir-list mailing list