cURL / Mailing Lists / curl-library / Single Mail

curl-library

Streamlining plattform checks

From: Marc Hoersken <info_at_marc-hoersken.de>
Date: Fri, 14 Sep 2012 08:20:50 +0200

Hello everyone,

while looking over some source code and the "CONTRIBUTE" document I
noticed that the following statements tends not to be followed through
the codebase:

----
2.7 Platform Dependent Code
Use #ifdef HAVE_FEATURE to do conditional code. We avoid checking for
particular operating systems or hardware in the #ifdef lines. The
HAVE_FEATURE shall be generated by the configure script for unix-like
systems and they are hard-coded in the config-[system].h files for the
others.
----
A grep over the codebase results in the following:
$ grep "WIN32" lib/*.c
lib/asyn-ares.c:     (defined(WIN32) || defined(_WIN32) ||
defined(__SYMBIAN32__))
lib/asyn-thread.c:#elif defined(USE_THREADS_WIN32)
lib/asyn-thread.c:#ifndef _WIN32_WCE
lib/asyn-thread.c:#if defined(HAVE_GETADDRINFO) &&
!defined(HAVE_GAI_STRERROR) && !defined(WIN32)
lib/connect.c:#ifdef WIN32
lib/connect.c:#ifdef _WIN32_WCE
lib/connect.c:#ifdef _WIN32_WCE
lib/curl_multibyte.c:#if defined(USE_WIN32_IDN) ||
(defined(USE_WINDOWS_SSPI) && defined(UNICODE))
lib/curl_multibyte.c:#endif /* USE_WIN32_IDN || (USE_WINDOWS_SSPI && UNICODE) */
lib/curl_rtmp.c:#ifdef _WIN32
lib/curl_schannel.c:#ifdef _WIN32_WCE
lib/curl_schannel.c:#ifdef _WIN32_WCE
lib/curl_schannel.c:#ifdef _WIN32_WCE
lib/curl_schannel.c:#ifdef _WIN32_WCE
lib/curl_schannel.c:#endif /* _WIN32_WCE */
lib/curl_sspi.c:#  ifdef _WIN32_WCE
lib/curl_sspi.c:    if(osver.dwPlatformId == VER_PLATFORM_WIN32_NT
lib/curl_threads.c:#elif defined(USE_THREADS_WIN32)
lib/curl_threads.c:#elif defined(USE_THREADS_WIN32)
lib/curl_threads.c:#ifdef _WIN32_WCE
lib/easy.c:#ifdef WIN32
lib/easy.c:#if defined(_WIN32_WCE)
lib/easy.c:  if(flags & CURL_GLOBAL_WIN32)
lib/easy.c:  if(init_flags & CURL_GLOBAL_WIN32)
lib/file.c:#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || \
lib/ftp.c:#ifdef _WIN32_WCE
lib/getenv.c:#ifdef _WIN32_WCE
lib/getenv.c:#ifdef WIN32
lib/idn_win32.c:#ifdef USE_WIN32_IDN
lib/idn_win32.c:#endif /* USE_WIN32_IDN */
lib/md5.c:#elif defined(_WIN32)
lib/ssh.c:#ifdef WIN32
lib/strerror.c:#ifdef _WIN32_WCE
lib/strerror.c:#ifdef _WIN32_WCE
lib/timeval.c:#if defined(WIN32) && !defined(MSDOS)
lib/url.c:#elif defined(USE_WIN32_IDN)
lib/url.c:#elif defined(USE_WIN32_IDN)
lib/url.c:#elif defined(USE_WIN32_IDN)
lib/version.c:     (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
lib/version.c:#ifdef USE_WIN32_IDN
lib/version.c:    ( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )
lib/version.c:#elif defined(USE_WIN32_IDN)
1. Do we want to clean that up and streamline the used definitions?
e.g. always check for WIN32 or _WIN32 where applicable.
2. Do we want to let ./configure and the other buildscripts set a more
generic flag for WIN32 in general and just use specific checks for
WCE, etc.?
Best regards,
Marc
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-14