qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1] Make inet_parse() non-static


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v1] Make inet_parse() non-static
Date: Tue, 11 Sep 2012 14:34:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Bharata B Rao <address@hidden> writes:

> From: Bharata B Rao <address@hidden>
>
> Make inet_parse() non static.
>
> - Make inet_parse() non-static so that other subsystems like gluster
>   can use it to parse inet addresses. As a pre-requisite, define and
>   globalize the qemu_inet_opts.

Please repost this as part of a series that needs non-static
inet_parse().  I'm worried parameter "block" will cause trouble, but I
can't see that without the users.

> - Extend inet_parse() to parse just 'address' also in addition to
>  'address:port'.

Separate patch, please.

> Signed-off-by: Bharata B Rao <address@hidden>
> ---
> Ideally I needn't use sscanf twice once for parsing host:port (checking
> return value of 2) and if that fails for parsing host w/o port (checking
> return value of 1). I could just check if sscanf returned 2 or 1 and decide
> if addr:port or just addr was provided, but in the latter case the
> pointer to the bytes consumed (&pos) doesn't get updated.

You can use two of them, like this:

    a_end = b_end = -1;
    sscanf(str, "%d%n:%d%n", &a, &a_end, &b, &b_end);
    if (b_end >= 0) ...

[...]



reply via email to

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