qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH qom v3 05/14] qom: Allow clearing of a Link prop


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH qom v3 05/14] qom: Allow clearing of a Link property
Date: Fri, 26 Sep 2014 14:59:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

Il 26/09/2014 07:19, Peter Crosthwaite ha scritto:
> By passing in NULL to object_property_set_link.
> 
> The lead user of this is the QDEV GPIO framework which will implement
> GPIO disconnects via an "unlink".
> 
> Reviewed-by: Alexander Graf <address@hidden>
> Signed-off-by: Peter Crosthwaite <address@hidden>
> ---
> 
>  qom/object.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index da0919a..fe2d1c9 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -870,7 +870,7 @@ char *object_property_get_str(Object *obj, const char 
> *name,
>  void object_property_set_link(Object *obj, Object *value,
>                                const char *name, Error **errp)
>  {
> -    gchar *path = object_get_canonical_path(value);
> +    gchar *path = value ? object_get_canonical_path(value) : NULL;

It should also work if you pass an empty string here.

If you do this, you do not need patch 4.

Paolo

>      object_property_set_str(obj, path, name, errp);
>      g_free(path);
>  }
> @@ -1173,7 +1173,7 @@ static void object_set_link_property(Object *obj, 
> Visitor *v, void *opaque,
>  
>      visit_type_str(v, &path, name, &local_err);
>  
> -    if (!local_err && strcmp(path, "") != 0) {
> +    if (!local_err && path && strcmp(path, "") != 0) {
>          new_target = object_resolve_link(obj, name, path, &local_err);
>      }
>  
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]