Received: from eggs.gnu.org ([208.118.235.92]:55247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOWoJ-0004mW-HB for qemu-devel@nongnu.org; Wed, 17 Oct 2012 12:49:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOWoI-0002bi-7N for qemu-devel@nongnu.org; Wed, 17 Oct 2012 12:49:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOWoH-0002be-UE for qemu-devel@nongnu.org; Wed, 17 Oct 2012 12:49:34 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9HGnXhL027798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Oct 2012 12:49:33 -0400 From: Markus Armbruster References: <1349877786-23514-1-git-send-email-pbonzini@redhat.com> <1349877786-23514-22-git-send-email-pbonzini@redhat.com> Date: Wed, 17 Oct 2012 18:49:31 +0200 In-Reply-To: <1349877786-23514-22-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Wed, 10 Oct 2012 16:03:02 +0200") Message-ID: <87sj9dt55w.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 21/25] qemu-sockets: return IPSocketAddress from inet_parse List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com Paolo Bonzini writes: > Reviewed-by: Luiz Capitulino > Signed-off-by: Paolo Bonzini > --- > 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. [...]