Paolo Bonzini <pbonz...@redhat.com> writes: > Reviewed-by: Luiz Capitulino <lcapitul...@redhat.com> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > 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. [...]