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

Re: [libvirt] [PATCH 2/3] parallels: cleanup parallelsOpen and fix error message



On Mon, Aug 13, 2012 at 07:50:13PM +0400, Dmitry Guryanov wrote:
> Do some cleanup of parallelsOpen, STREQ_NULLABLE can replace
> a lot of checks.
> 
> Also fix error message to be VIR_ERR_INTERNAL_ERROR, the same
> as in other drivers.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov parallels com>
> ---
>  src/parallels/parallels_driver.c |   17 +++++------------
>  1 files changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index 53b5a50..d8e7ae8 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -665,21 +665,14 @@ parallelsOpen(virConnectPtr conn,
>          return VIR_DRV_OPEN_DECLINED;
>  
>      /* From this point on, the connection is for us. */
> -    if (
> -        conn->uri->path[0] == '\0' ||
> -        (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) {
> -        virReportError(VIR_ERR_INVALID_ARG, "%s",
> -                       _("parallelsOpen: supply a path or use "
> -                         "parallels:///system"));
> +    if (!STREQ_NULLABLE(conn->uri->path, "/system")) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("Unexpected Parallels URI path '%s', try parallels:///system"),
> +                       conn->uri->path);
>          return VIR_DRV_OPEN_ERROR;
>      }
>  
> -    if (STREQ(conn->uri->path, "/system"))
> -        ret = parallelsOpenDefault(conn);
> -    else
> -        return VIR_DRV_OPEN_DECLINED;
> -
> -    if (ret != VIR_DRV_OPEN_SUCCESS)
> +    if ((ret = parallelsOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS)
>          return ret;
>  
>      return VIR_DRV_OPEN_SUCCESS;

  Okay, semantic is the same except you return OPEN_ERROR instead
of OPEN_DECLINED, still sounds fine,

ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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