Re: [PATCHv2 2/4] virsocket: Introduce virSocketAddrIsWildcard

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

 



On 10/09/2013 03:32 PM, Michal Privoznik wrote:
> This function takes exactly one argument: an address to check.
> It returns true, iff the address is an IPv4 or IPv6 address in numeric

Why use "iff" if you still need to say what happens otherwise? :)

> format, false if otherwise (e.g. for "examplehost").

s/ if//

> @@ -824,3 +839,27 @@ virSocketAddrGetIpPrefix(const virSocketAddrPtr address,
>       */
>      return 0;
>  }

Missing space.

> +/**
> + * virSocketAddrIsNumeric:
> + * @address: address to check
> + *
> + * Check if passed address is an IP address in numeric format. For
> + * instance, for 0.0.0.0 true is returned, for 'examplehost"
> + * false is returned.
> + *
> + * Returns: true iff @address is an IP address,

See my comment for the commit message.

> + *          false otherwise
> + */
> +bool
> +virSocketAddrIsNumeric(const char *address)
> +{
> +    struct addrinfo *res;
> +    unsigned short family;
> +
> +    if (virSocketAddrParseInternal(&res, address, AF_UNSPEC, false) < 0)
> +        return false;
> +
> +    family = res->ai_addr->sa_family;

Is this any different than using int res->ai_family?

> +    freeaddrinfo(res);
> +    return family == AF_INET || family == AF_INET6;
> +}

ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]