[libvirt] [PATCH 2/5] xen: Remove extraneous checks in xenStoreGetDomainInfo()

Daniel P. Berrange berrange at redhat.com
Tue Jan 15 18:42:22 UTC 2013


On Tue, Jan 15, 2013 at 01:35:35PM -0500, John Ferlan wrote:
> The VIR_IS_CONNECTED_DOMAIN() will already check/return -1 if domain or
> domain->conn are NULL.
> ---
>  src/xen/xs_internal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
> index 9308522..4ccab20 100644
> --- a/src/xen/xs_internal.c
> +++ b/src/xen/xs_internal.c
> @@ -382,7 +382,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
>      if (!VIR_IS_CONNECTED_DOMAIN(domain))
>          return -1;
>  
> -    if ((domain == NULL) || (domain->conn == NULL) || (info == NULL)) {
> +    if (info == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
>          return -1;
>      }

Actually this entire check should be removed, along with the VIR_IS_CONNECTED_DOMAIN check. This is obsolete code, because the same thing is now checked
in the caller (src/libvirt.c  virDomainGetInfo). Likewise for similar code
in this & other files in src/xen/

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list