On 2014/12/03 21:13, Michal Nazarewicz <[email protected]> wrote:
> From: Michal Nazarewicz <[email protected]>
> 
> If $MPD_PORT is not a number, i.e. does not start with a digit,
> attempt to resolve it using getservbyname, i.e. by reading the
> /etc/services database.

This now passes the build test, but I don't like how this adds
unnecessary overhead to the non-TCP build.

Instead of just "atoi(str)", the !ENABLE_TCP build does:

> +     if (!*str)
> +             return 0;
> +     if (isdigit(str[0]))
> +             return atoi(str);
> +
> +     return 0;

Now if you move the #ifdef, this gets eliminated easily.

Further improvement (of existing code): remove the whole MPD_PORT
parser if !ENABLE_TCP.
_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to