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

Re: [libvirt] [PATCH v1 07/11] virStoragePoolObjListAdd: Separate out definition assignment




On 5/24/19 10:35 AM, Michal Privoznik wrote:
> Separate storage pool definition assignment into a function.
> 
> Signed-off-by: Michal Privoznik <mprivozn redhat com>
> ---
>  src/conf/virstorageobj.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
> index 7515b5d107..2b9ad6fc98 100644
> --- a/src/conf/virstorageobj.c
> +++ b/src/conf/virstorageobj.c
> @@ -1505,6 +1505,21 @@ virStoragePoolObjSourceFindDuplicate(virStoragePoolObjListPtr pools,
>  }
>  
>  
> +static void
> +virStoragePoolObjAssignDef(virStoragePoolObjPtr obj,
> +                           virStoragePoolDefPtr def,
> +                           unsigned int flgs ATTRIBUTE_UNUSED)
> +{
> +    if (!virStoragePoolObjIsActive(obj)) {
> +        virStoragePoolDefFree(obj->def);
> +        obj->def = def;
> +    } else {
> +        virStoragePoolDefFree(obj->newDef);
> +        obj->newDef = def;
> +    }
> +}
> +
> +
>  /**
>   * virStoragePoolObjListAdd:
>   * @pools: Storage Pool object list pointer
> @@ -1540,14 +1555,8 @@ virStoragePoolObjListAdd(virStoragePoolObjListPtr pools,
>      if (rc < 0)
>          goto error;
>      if (rc > 0) {
> -        if (!virStoragePoolObjIsActive(obj)) {
> -            virStoragePoolDefFree(obj->def);
> -            obj->def = def;
> -        } else {
> -            virStoragePoolDefFree(obj->newDef);
> -            obj->newDef = def;
> -        }
>          virObjectRWUnlock(pools);
> +        virStoragePoolObjAssignDef(obj, def, flags);

Was it intentional to swap the order?

John

>          return obj;
>      }
>  
> 


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