On 2013年01月31日 02:51, John Ferlan wrote:
Arguments for driver entry points are checked in libvirt.c, so no need to check again. --- src/xen/xs_internal.c | 139 ++++++++++---------------------------------------- 1 file changed, 28 insertions(+), 111 deletions(-) diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 9308522..573c0c6 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -1,7 +1,7 @@ /* * xs_internal.c: access to Xen Store * - * Copyright (C) 2006, 2009-2012 Red Hat, Inc. + * Copyright (C) 2006, 2009-2013 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -86,12 +86,8 @@ static char ** virConnectDoStoreList(virConnectPtr conn, const char *path, unsigned int *nb) { - xenUnifiedPrivatePtr priv; - - if (conn == NULL) - return NULL; + xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData; - priv = (xenUnifiedPrivatePtr) conn->privateData; if (priv->xshandle == NULL || path == NULL || nb == NULL) return NULL; @@ -113,12 +109,8 @@ virDomainDoStoreQuery(virConnectPtr conn, int domid, const char *path) { char s[256]; unsigned int len = 0; - xenUnifiedPrivatePtr priv; - - if (!conn) - return NULL; + xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData; - priv = (xenUnifiedPrivatePtr) conn->privateData; if (priv->xshandle == NULL) return NULL; @@ -143,16 +135,11 @@ virDomainDoStoreWrite(virDomainPtr domain, const char *path, const char *value) { char s[256]; - xenUnifiedPrivatePtr priv; + xenUnifiedPrivatePtr priv = + (xenUnifiedPrivatePtr) domain->conn->privateData; int ret = -1; - if (!VIR_IS_CONNECTED_DOMAIN(domain)) - return -1; - - priv = (xenUnifiedPrivatePtr) domain->conn->privateData; - if (priv->xshandle == NULL) - return -1; - if (domain->conn->flags& VIR_CONNECT_RO) + if (priv->xshandle == NULL || domain->conn->flags& VIR_CONNECT_RO) return -1; snprintf(s, 255, "/local/domain/%d/%s", domain->id, path); @@ -178,12 +165,9 @@ virDomainGetVM(virDomainPtr domain) char *vm; char query[200]; unsigned int len; - xenUnifiedPrivatePtr priv; - - if (!VIR_IS_CONNECTED_DOMAIN(domain)) - return NULL; + xenUnifiedPrivatePtr priv = + (xenUnifiedPrivatePtr) domain->conn->privateData;
ACK with changing lines like this into 1 line. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list