curl-library
Re: Name lookup/DNS resolution mechanism of libcurl
Date: Wed, 10 Apr 2013 01:21:05 +0200
Hi Gisle,
On 10.04.2013 00:07, Gisle Vanem wrote:
> Thanks for fixing this. I wrote about this in this thread:
> http://curl.haxx.se/mail/lib-2013-01/0131.html
>
> earlier this year. Your patch below looks good here.
> Except:
>
> +#if !defined(USE_ARES) && !defined(USE_THREADS_WIN32)
> # define USE_THREADS_WIN32 1
> +#elif defined(USE_THREADS_WIN32) && USE_THREADS_WIN32 == 0
> +# undef USE_THREADS_WIN32
> #endif
>
> How can USE_THREADS_WIN32 both be defined and set to 0?
> The "&& USE_THREADS_WIN32 == 0" part is superfluous AFAICS.
well, simply by -DUSE_THREADS_WIN32=0 ...
try this:
#include <stdio.h>
int main() {
#if !defined(TEST)
printf("TEST: undefined\n");
#else
printf("TEST: defined\n");
#if TEST >= 0
printf("TEST: %d\n", TEST);
#endif
#endif
return 0;
}
gcc -Wall -O2 tdef.c -o tdef ; ./tdef
TEST: undefined
gcc -Wall -O2 -DTEST tdef.c -o tdef ; ./tdef
TEST: defined
TEST: 1
gcc -Wall -O2 -DTEST=0 tdef.c -o tdef ; ./tdef
TEST: defined
TEST: 0
gcc -Wall -O2 -DTEST=1 tdef.c -o tdef ; ./tdef
TEST: defined
TEST: 1
so that means if we have somewhere in the code:
#ifdef USE_THREADS_WIN32
it will be processed no matter if you define USE_THREADS_WIN32=1 or
USE_THREADS_WIN32=0, hence its needed to explicitely undef it if we see
it defined to 0 so that we are able to have both USE_ARES *and*
USE_THREADS_WIN32 undefined in order to use the syncronous DNS ...
then we must keep in mind that neither USE_ARES nor USE_THREADS_WIN32 is
defined we want keep to default to USE_THREADS_WIN32=1 ...., argh ..
this is necessary in order to not break previous behaviour ...
honestly I'm not happy with that hack, and if someone has something
better in mind please speak up!
Gün.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-10