cURL / Mailing Lists / curl-library / Single Mail

curl-library

[Patch] USE_LWIPSOCK and MSVC

From: Gisle Vanem <gvanem_at_yahoo.no>
Date: Mon, 7 Dec 2015 14:51:57 +0100

The C-preprocessor in Visual-C (even in MSVC 2015) is pretty
lame compared to Gnu-C. In select.c (around line 317 and 523):

    r = select((int)maxfd + 1,
#ifndef USE_WINSOCK
               &fds_read,
               &fds_write,
#else
               fds_read.fd_count ? &fds_read : NULL,
               fds_write.fd_count ? &fds_write : NULL,
#endif
               &fds_err, ptimeout);

this causes lots of parse errors since with USE_LWIPSOCK, select() is a
macro (-> lwip_select()). And MSVC doesn't like a '#' inside macros.

The attached patch reverses the logic. IMHO '#ifdef USE_WINSOCK' is more
readable than '#ifndef USE_WINSOCK'.

-- 
--gv


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2015-12-07