Skip to content

Commit d445f2d

Browse files
committed
lib: skip compiling code with features disabled
In non-SSL, non-SSH, non-H3, non-AppleSecTrust builds. Also: - drop unused internal macro `SSL_SYSTEM_VERIFIER`. Closes curl#20587
1 parent 0649eb0 commit d445f2d

File tree

10 files changed

+31
-28
lines changed

10 files changed

+31
-28
lines changed

lib/vquic/vquic.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,35 @@
2222
*
2323
***************************************************************************/
2424
#include "../curl_setup.h"
25+
#include "../urldata.h"
26+
#include "vquic.h"
27+
28+
#include "../curl_trc.h"
29+
30+
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
2531

2632
#ifdef HAVE_NETINET_UDP_H
2733
#include <netinet/udp.h>
2834
#endif
35+
2936
#ifdef USE_NGHTTP3
3037
#include <nghttp3/nghttp3.h>
3138
#endif
32-
#include "../urldata.h"
39+
3340
#include "../bufq.h"
3441
#include "../curlx/dynbuf.h"
3542
#include "../curlx/fopen.h"
3643
#include "../cfilters.h"
37-
#include "../curl_trc.h"
3844
#include "curl_ngtcp2.h"
3945
#include "curl_quiche.h"
4046
#include "../multiif.h"
4147
#include "../progress.h"
4248
#include "../rand.h"
43-
#include "vquic.h"
4449
#include "vquic_int.h"
4550
#include "../curlx/strerr.h"
4651
#include "../curlx/strparse.h"
4752

4853

49-
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
50-
5154
#define NW_CHUNK_SIZE (64 * 1024)
5255
#define NW_SEND_CHUNKS 1
5356

lib/vquic/vquic_int.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
***************************************************************************/
2626
#include "../curl_setup.h"
2727

28-
#include "../bufq.h"
29-
3028
#ifdef USE_HTTP3
3129

30+
#include "../bufq.h"
31+
3232
#define MAX_PKT_BURST 10
3333
#define MAX_UDP_PAYLOAD_SIZE 1452
3434

@@ -121,8 +121,6 @@ CURLcode vquic_recv_packets(struct Curl_cfilter *cf,
121121
size_t max_pkts,
122122
vquic_recv_pkts_cb *recv_cb, void *userp);
123123

124-
#endif /* !USE_HTTP3 */
125-
126124
#ifdef USE_NGTCP2
127125
struct ngtcp2_mem;
128126
struct ngtcp2_mem *Curl_ngtcp2_mem(void);
@@ -132,4 +130,6 @@ struct nghttp3_mem;
132130
struct nghttp3_mem *Curl_nghttp3_mem(void);
133131
#endif
134132

133+
#endif /* !USE_HTTP3 */
134+
135135
#endif /* HEADER_CURL_VQUIC_QUIC_INT_H */

lib/vssh/ssh.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424
*
2525
***************************************************************************/
2626
#include "../curl_setup.h"
27+
#include "../urldata.h"
2728

2829
extern const struct Curl_protocol Curl_protocol_sftp;
2930
extern const struct Curl_protocol Curl_protocol_scp;
3031

3132
extern const struct Curl_scheme Curl_scheme_sftp;
3233
extern const struct Curl_scheme Curl_scheme_scp;
3334

35+
#ifdef USE_SSH
36+
3437
#ifdef USE_LIBSSH2
3538
#include <libssh2.h>
3639
#include <libssh2_sftp.h>
@@ -236,8 +239,6 @@ struct ssh_conn {
236239

237240
#endif /* USE_LIBSSH2 */
238241

239-
#ifdef USE_SSH
240-
241242
#ifdef CURLVERBOSE
242243
const char *Curl_ssh_statename(sshstate state);
243244
#else
@@ -255,11 +256,10 @@ void Curl_ssh_cleanup(void);
255256
void Curl_ssh_version(char *buffer, size_t buflen);
256257
void Curl_ssh_attach(struct Curl_easy *data,
257258
struct connectdata *conn);
258-
#else
259-
/* for non-SSH builds */
259+
#else /* !USE_SSH */
260260
#define Curl_ssh_cleanup()
261261
#define Curl_ssh_attach(x, y)
262262
#define Curl_ssh_init() 0
263-
#endif
263+
#endif /* USE_SSH */
264264

265265
#endif /* HEADER_CURL_SSH_H */

lib/vssh/vssh.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
*
2323
***************************************************************************/
2424
#include "../curl_setup.h"
25-
26-
#include "vssh.h"
2725
#include "ssh.h"
26+
2827
#ifdef USE_SSH
28+
29+
#include "vssh.h"
2930
#include "../curlx/strparse.h"
3031
#include "../curl_trc.h"
3132
#include "../escape.h"

lib/vssh/vssh.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
***************************************************************************/
2626
#include "../curl_setup.h"
2727

28+
#ifdef USE_SSH
29+
2830
#include "../urldata.h"
2931

3032
CURLcode Curl_getworkingpath(struct Curl_easy *data,
@@ -36,5 +38,5 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir);
3638
CURLcode Curl_ssh_range(struct Curl_easy *data,
3739
const char *range, curl_off_t filesize,
3840
curl_off_t *startp, curl_off_t *sizep);
39-
41+
#endif /* USE_SSH */
4042
#endif /* HEADER_CURL_VSSH_VSSH_H */

lib/vtls/apple.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,15 @@
4040

4141
#include "../curl_setup.h"
4242

43+
#ifdef USE_APPLE_SECTRUST
44+
4345
#include "../urldata.h"
4446
#include "../cfilters.h"
4547
#include "../curl_trc.h"
4648
#include "vtls.h"
4749
#include "apple.h"
4850

49-
#ifdef USE_APPLE_SECTRUST
5051
#include <Security/Security.h>
51-
#endif
52-
53-
54-
#ifdef USE_APPLE_SECTRUST
55-
#define SSL_SYSTEM_VERIFIER
5652

5753
#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && \
5854
MAC_OS_X_VERSION_MAX_ALLOWED >= 101400) || \

lib/vtls/schannel_verify.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "../curl_setup.h"
3131

3232
#ifdef USE_SCHANNEL
33+
3334
#ifndef USE_WINDOWS_SSPI
3435
#error "cannot compile Schannel support without SSPI."
3536
#endif

lib/vtls/vtls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static const struct alpn_spec ALPN_SPEC_H2_H11 = {
147147
static const struct alpn_spec ALPN_SPEC_H11_H2 = {
148148
{ ALPN_HTTP_1_1, ALPN_H2 }, 2
149149
};
150-
#endif
150+
#endif /* USE_HTTP2 */
151151

152152
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_PROXY)
153153
static const struct alpn_spec *alpn_get_spec(http_majors wanted,

lib/vtls/vtls_int.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
***************************************************************************/
2626
#include "../curl_setup.h"
2727

28+
#ifdef USE_SSL
29+
2830
#include "../cfilters.h"
2931
#include "../select.h"
3032
#include "../urldata.h"
3133
#include "vtls.h"
3234

33-
#ifdef USE_SSL
34-
3535
struct Curl_ssl;
3636
struct ssl_connect_data;
3737
struct Curl_ssl_session;

lib/vtls/vtls_scache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
***************************************************************************/
2626
#include "../curl_setup.h"
2727

28+
#ifdef USE_SSL
29+
2830
#include "../cfilters.h"
2931
#include "../urldata.h"
3032

31-
#ifdef USE_SSL
32-
3333
struct Curl_cfilter;
3434
struct Curl_easy;
3535
struct Curl_ssl_scache;

0 commit comments

Comments
 (0)