mirror of
https://github.com/curl/curl.git
synced 2026-08-25 06:03:32 +03:00
tests/server: round of tidy-ups (part 2)
General tidy-ups, to identify and reduce duplications and potential issues, while also making the server modules compile as a single binary. - ensure unique symbols and no shadowing across server sources, by renaming variables. - move globals common to multiple servers into shared `util` module. - drop constants with a single use. - undef macro before re-using them across server sources. - move common functions into shared `util` module. - drop redundant static declarations. - disable IPv6 code when built without IPv6. - start syncing the 3 almost identical copies of `sockdaemon` function. - drop unused `timeval.h` header. - drop `poll()` from `wait_ms()`, for macOS, following an earlier core update. Follow-up toc72cefea0f#15096 Follow-up to9213e4e497#16525 Cherry-picked from #15000 Closes #16609
This commit is contained in:
parent
07f99b72d5
commit
bc55b435af
9 changed files with 369 additions and 430 deletions
|
|
@ -50,9 +50,6 @@
|
|||
/* include memdebug.h last */
|
||||
#include "memdebug.h"
|
||||
|
||||
static bool use_ipv6 = FALSE;
|
||||
static const char *ipv_inuse = "IPv4";
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int arg = 1;
|
||||
|
|
@ -71,14 +68,21 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
else if(!strcmp("--ipv6", argv[arg])) {
|
||||
#if defined(CURLRES_IPV6)
|
||||
ipv_inuse = "IPv6";
|
||||
use_ipv6 = TRUE;
|
||||
arg++;
|
||||
#else
|
||||
puts("IPv6 support has been disabled in this program");
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
else if(!strcmp("--ipv4", argv[arg])) {
|
||||
/* for completeness, we support this option as well */
|
||||
ipv_inuse = "IPv4";
|
||||
#if defined(CURLRES_IPV6)
|
||||
use_ipv6 = FALSE;
|
||||
#endif
|
||||
arg++;
|
||||
}
|
||||
else {
|
||||
|
|
@ -127,13 +131,8 @@ int main(int argc, char *argv[])
|
|||
freeaddrinfo(ai);
|
||||
}
|
||||
#else
|
||||
if(use_ipv6) {
|
||||
puts("IPv6 support has been disabled in this program");
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
/* gethostbyname() resolve */
|
||||
struct hostent *he;
|
||||
{
|
||||
struct hostent *he; /* gethostbyname() resolve */
|
||||
|
||||
#ifdef __AMIGA__
|
||||
he = gethostbyname((unsigned char *)host);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue