Re: [PATCH 07/11] Replace virStreamFree with virObjectUnref

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

 



On 12/01/14 16:56, John Ferlan wrote:
> Since virStreamFree will call virObjectUnref anyway, let's just use that
> directly so as to avoid the possibility that we inadvertently clear out
> a pending error message when using the public API.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  cfg.mk                     | 4 ++--
>  daemon/remote.c            | 2 +-
>  daemon/stream.c            | 2 +-
>  src/conf/virchrdev.c       | 4 ++--
>  src/fdstream.c             | 2 +-
>  src/remote/remote_driver.c | 2 +-
>  6 files changed, 8 insertions(+), 8 deletions(-)
> 

> diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c
> index 022fe71..3e7df7e 100644
> --- a/src/conf/virchrdev.c
> +++ b/src/conf/virchrdev.c

> @@ -439,7 +439,7 @@ int virChrdevOpen(virChrdevsPtr devs,
>      if (added)
>          virHashRemoveEntry(devs->hash, path);
>      else
> -        virStreamFree(st);
> +        virObjectUnref(st);
>  
>      virSetError(savedError);
>      virFreeError(savedError);

virHashRemoveEntry doesn't taint the error so you can get rid of the
code that saves error and returns it

> diff --git a/src/fdstream.c b/src/fdstream.c
> index 9ff7e2a..a020cdd 100644
> --- a/src/fdstream.c
> +++ b/src/fdstream.c
> @@ -188,7 +188,7 @@ static void virFDStreamEvent(int watch ATTRIBUTE_UNUSED,
>  static void virFDStreamCallbackFree(void *opaque)
>  {
>      virStreamPtr st = opaque;
> -    virStreamFree(st);
> +    virObjectUnref(st);

virObjectUnref() takes void * so you could get rid of the intermediate
variable.

>  }
>  
>  

ACK with or without changes.

Peter

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]