From: Viktor Szakats Date: Sat, 28 Feb 2026 23:54:09 +0000 (+0100) Subject: build: include curlx headers directly in src and tests X-Git-Tag: rc-8_20_0-1~260 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=030d6aeaf301cf03c322dc8cfbc7fd05018e3d55;p=thirdparty%2Fcurl.git build: include curlx headers directly in src and tests To include what's actually used. Also: - drop unused includes. - scope includes where possible. - drop `curlx/curlx.h` umbrella header. - config2setopts: include `netinet/in.h` for Cygwin/MSYS2. Previously included by chance via an unused curlx include. Closes #20776 --- diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 1b75dc42ed..700fc2d4f9 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -47,7 +47,6 @@ LIB_CURLX_CFILES = \ LIB_CURLX_HFILES = \ curlx/base64.h \ curlx/basename.h \ - curlx/curlx.h \ curlx/dynbuf.h \ curlx/fopen.h \ curlx/inet_ntop.h \ diff --git a/lib/curlx/curlx.h b/lib/curlx/curlx.h deleted file mode 100644 index 79cffc8f6d..0000000000 --- a/lib/curlx/curlx.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef HEADER_CURL_CURLX_H -#define HEADER_CURL_CURLX_H -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at https://curl.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * SPDX-License-Identifier: curl - * - ***************************************************************************/ - -/* - * Defines protos and includes all header files that provide the curlx_* - * functions. The curlx_* functions are not part of the libcurl API, but are - * stand-alone functions whose sources can be built and linked by apps if need - * be. - */ - -#include "curlx/base64.h" /* for curlx_base64* */ -#include "curlx/basename.h" /* for curlx_basename() */ -#include "curlx/dynbuf.h" /* for curlx_dyn_*() */ -#include "curlx/fopen.h" /* for curlx_f*() */ -#include "curlx/inet_ntop.h" /* for curlx_inet_ntop() */ -#include "curlx/inet_pton.h" /* for curlx_inet_pton() */ -#include "curlx/multibyte.h" /* for curlx_convert_*() */ -#include "curlx/nonblock.h" /* for curlx_nonblock() */ -#include "curlx/strcopy.h" /* for curlx_strcopy() */ -#include "curlx/strdup.h" /* for curlx_memdup*() and curlx_tcsdup() */ -#include "curlx/strerr.h" /* for curlx_strerror() */ -#include "curlx/strparse.h" /* for curlx_str_* parsing functions */ -#include "curlx/timediff.h" /* for timediff_t type and related functions */ -#include "curlx/timeval.h" /* for curlx_now type and related functions */ -#include "curlx/version_win32.h" /* for curlx_verify_windows_version() */ -#include "curlx/wait.h" /* for curlx_wait_ms() */ -#include "curlx/winapi.h" /* for curlx_winapi_strerror() */ - -#endif /* HEADER_CURL_CURLX_H */ diff --git a/src/config2setopts.c b/src/config2setopts.c index 420d13d249..543322ba76 100644 --- a/src/config2setopts.c +++ b/src/config2setopts.c @@ -40,6 +40,10 @@ #include "tool_helpers.h" #include "tool_version.h" +#ifdef HAVE_NETINET_IN_H +#include /* IPPROTO_IPV6 */ +#endif + #define BUFFER_SIZE 102400L #ifdef IP_TOS diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 6a1b904dc0..4b2a2a34b3 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -25,6 +25,9 @@ #if defined(_WIN32) || defined(MSDOS) +#include "curlx/basename.h" /* for curlx_basename() */ +#include "curlx/version_win32.h" /* for curlx_verify_windows_version() */ + #ifdef _WIN32 # include #elif !defined(__DJGPP__) || (__DJGPP__ < 2) /* DJGPP 2.0 has _use_lfn() */ diff --git a/src/tool_operate.c b/src/tool_operate.c index c4d97a9754..6c47c13631 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -23,6 +23,8 @@ ***************************************************************************/ #include "tool_setup.h" +#include "curlx/nonblock.h" /* for curlx_nonblock() */ + #ifdef HAVE_LOCALE_H # include #endif diff --git a/src/tool_setup.h b/src/tool_setup.h index b2ce031c13..43acdbfeb7 100644 --- a/src/tool_setup.h +++ b/src/tool_setup.h @@ -45,7 +45,17 @@ extern FILE *tool_stderr; * curl tool certainly uses libcurl's external interface. */ -#include +#include "curlx/base64.h" /* for curlx_base64* */ +#include "curlx/dynbuf.h" /* for curlx_dyn_*() */ +#include "curlx/fopen.h" /* for curlx_f*() */ +#include "curlx/multibyte.h" /* for curlx_convert_*() */ +#include "curlx/strcopy.h" /* for curlx_strcopy() */ +#include "curlx/strdup.h" /* for curlx_memdup*() */ +#include "curlx/strerr.h" /* for curlx_strerror() */ +#include "curlx/strparse.h" /* for curlx_str_* parsing functions */ +#include "curlx/timediff.h" /* for timediff_t type and related functions */ +#include "curlx/timeval.h" /* for curlx_now type and related functions */ +#include "curlx/wait.h" /* for curlx_wait_ms() */ /* * Platform specific stuff. diff --git a/tests/libtest/first.h b/tests/libtest/first.h index 8db531be1f..2c8e46ca59 100644 --- a/tests/libtest/first.h +++ b/tests/libtest/first.h @@ -43,7 +43,15 @@ extern const struct entry_s s_entries[]; extern int unitfail; /* for unittests */ -#include +#include "curlx/base64.h" /* for curlx_base64* */ +#include "curlx/dynbuf.h" /* for curlx_dyn_*() */ +#include "curlx/fopen.h" /* for curlx_f*() */ +#include "curlx/strcopy.h" /* for curlx_strcopy() */ +#include "curlx/strerr.h" /* for curlx_strerror() */ +#include "curlx/strparse.h" /* for curlx_str_* parsing functions */ +#include "curlx/timediff.h" /* for timediff_t type and related functions */ +#include "curlx/timeval.h" /* for curlx_now type and related functions */ +#include "curlx/wait.h" /* for curlx_wait_ms() */ #ifdef HAVE_SYS_SELECT_H /* since so many tests use select(), we can just as well include it here */ diff --git a/tests/server/first.h b/tests/server/first.h index 4cc65ede7e..ad5cec41b3 100644 --- a/tests/server/first.h +++ b/tests/server/first.h @@ -62,7 +62,18 @@ extern const struct entry_s s_entries[]; #include #endif -#include +#include "curlx/base64.h" /* for curlx_base64* */ +#include "curlx/fopen.h" /* for curlx_f*() */ +#include "curlx/inet_ntop.h" /* for curlx_inet_ntop() */ +#include "curlx/inet_pton.h" /* for curlx_inet_pton() */ +#include "curlx/nonblock.h" /* for curlx_nonblock() */ +#include "curlx/strcopy.h" /* for curlx_strcopy() */ +#include "curlx/strerr.h" /* for curlx_strerror() */ +#include "curlx/strparse.h" /* for curlx_str_* parsing functions */ +#include "curlx/timediff.h" /* for timediff_t type and related functions */ +#include "curlx/timeval.h" /* for curlx_now type and related functions */ +#include "curlx/wait.h" /* for curlx_wait_ms() */ +#include "curlx/winapi.h" /* for curlx_winapi_strerror() */ #ifdef _WIN32 #include