qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 21/25] qemu-sockets: return IPSocketAddress from


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 21/25] qemu-sockets: return IPSocketAddress from inet_parse
Date: Wed, 17 Oct 2012 18:49:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> Reviewed-by: Luiz Capitulino <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  qemu-sockets.c | 119 
> +++++++++++++++++++++++++++++++++++++--------------------
>  1 file modificato, 78 inserzioni(+), 41 rimozioni(-)
>
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index a37f35d..5946962 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -480,54 +480,91 @@ err:
>  }
>  
>  /* compatibility wrapper */
> -static void inet_parse(QemuOpts *opts, const char *str, Error **errp)
> +static IPSocketAddress *inet_parse(const char *str, Error **errp)
>  {
> +    IPSocketAddress *addr;
>      const char *optstr, *h;
> -    char addr[64];
> +    char host[64];
>      char port[33];
> +    int to;
>      int pos;
>  
> +    addr = g_new(IPSocketAddress, 1);
> +
>      /* parse address */
>      if (str[0] == ':') {
>          /* no host given */
> -        addr[0] = '\0';
> +        host[0] = '\0';
>          if (1 != sscanf(str,":%32[^,]%n",port,&pos)) {
>              error_setg(errp, "error parsing port in address '%s'", str);
> -            return;
> +            goto fail;
>          }
>      } else if (str[0] == '[') {
>          /* IPv6 addr */
> -        if (2 != sscanf(str,"[%64[^]]]:%32[^,]%n",addr,port,&pos)) {
> +        if (2 != sscanf(str,"[%64[^]]]:%32[^,]%n",host,port,&pos)) {

Since you touch the line anyway, you could fix up style (space after
comma).  More of the same below.

[...]



reply via email to

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