From 0e2208ada6e4c3edeb01ce242e3e2ca06084680b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 5 May 2019 17:08:21 +0200 Subject: wildcard: disable from build when FTP isn't present --- lib/fileinfo.c | 5 +++-- lib/multi.c | 7 ++++++- lib/setopt.c | 2 ++ lib/transfer.c | 2 ++ lib/urldata.h | 2 ++ lib/wildcard.c | 6 +++++- lib/wildcard.h | 10 ++++++++-- 7 files changed, 28 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/fileinfo.c b/lib/fileinfo.c index 4e72e1eba..2630c9e46 100644 --- a/lib/fileinfo.c +++ b/lib/fileinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2010 - 2018, Daniel Stenberg, , et al. + * Copyright (C) 2010 - 2019, 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 @@ -21,7 +21,7 @@ ***************************************************************************/ #include "curl_setup.h" - +#ifndef CURL_DISABLE_FTP #include "strdup.h" #include "fileinfo.h" #include "curl_memory.h" @@ -41,3 +41,4 @@ void Curl_fileinfo_cleanup(struct fileinfo *finfo) Curl_safefree(finfo->info.b_data); free(finfo); } +#endif diff --git a/lib/multi.c b/lib/multi.c index 71217989b..09e4830c6 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1568,6 +1568,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(!result) { if(!dophase_done) { +#ifndef CURL_DISABLE_FTP /* some steps needed for wildcard matching */ if(data->state.wildcardmatch) { struct WildcardData *wc = &data->wildcard; @@ -1579,6 +1580,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, break; } } +#endif /* DO was not completed in one function call, we must continue DOING... */ multistate(data, CURLM_STATE_DOING); @@ -1718,10 +1720,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, (data->conn->writesockfd != CURL_SOCKET_BAD)) multistate(data, CURLM_STATE_PERFORM); else { +#ifndef CURL_DISABLE_FTP if(data->state.wildcardmatch && ((data->conn->handler->flags & PROTOPT_WILDCARD) == 0)) { data->wildcard.state = CURLWC_DONE; } +#endif multistate(data, CURLM_STATE_DONE); } rc = CURLM_CALL_MULTI_PERFORM; @@ -1942,6 +1946,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, detach_connnection(data); } +#ifndef CURL_DISABLE_FTP if(data->state.wildcardmatch) { if(data->wildcard.state != CURLWC_DONE) { /* if a wildcard is set and we are not ending -> lets start again @@ -1950,7 +1955,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, break; } } - +#endif /* after we have DONE what we're supposed to do, go COMPLETED, and it doesn't matter what the multi_done() returned! */ multistate(data, CURLM_STATE_COMPLETED); diff --git a/lib/setopt.c b/lib/setopt.c index 6352f486a..e5450d020 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -2482,12 +2482,14 @@ static CURLcode vsetopt(struct Curl_easy *data, CURLoption option, case CURLOPT_FNMATCH_FUNCTION: data->set.fnmatch = va_arg(param, curl_fnmatch_callback); break; +#ifndef CURL_DISABLE_FTP case CURLOPT_CHUNK_DATA: data->wildcard.customptr = va_arg(param, void *); break; case CURLOPT_FNMATCH_DATA: data->set.fnmatch_data = va_arg(param, void *); break; +#endif #ifdef USE_TLS_SRP case CURLOPT_TLSAUTH_USERNAME: result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_ORIG], diff --git a/lib/transfer.c b/lib/transfer.c index a451fb74e..32e19bd0f 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1506,6 +1506,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) data->state.authhost.picked &= data->state.authhost.want; data->state.authproxy.picked &= data->state.authproxy.want; +#ifndef CURL_DISABLE_FTP if(data->state.wildcardmatch) { struct WildcardData *wc = &data->wildcard; if(wc->state < CURLWC_INIT) { @@ -1514,6 +1515,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) return CURLE_OUT_OF_MEMORY; } } +#endif } return result; diff --git a/lib/urldata.h b/lib/urldata.h index 09194472d..44d25e03a 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1803,7 +1803,9 @@ struct Curl_easy { struct Progress progress; /* for all the progress meter data */ struct UrlState state; /* struct for fields used for state info and other dynamic purposes */ +#ifndef CURL_DISABLE_FTP struct WildcardData wildcard; /* wildcard download state info */ +#endif struct PureInfo info; /* stats, reports and info data */ struct curl_tlssessioninfo tsi; /* Information about the TLS session, only valid after a client has asked for it */ diff --git a/lib/wildcard.c b/lib/wildcard.c index 8ba0989b4..e94d3c544 100644 --- a/lib/wildcard.c +++ b/lib/wildcard.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2019, 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 @@ -22,6 +22,8 @@ #include "curl_setup.h" +#ifndef CURL_DISABLE_FTP + #include "wildcard.h" #include "llist.h" #include "fileinfo.h" @@ -67,3 +69,5 @@ void Curl_wildcard_dtor(struct WildcardData *wc) wc->customptr = NULL; wc->state = CURLWC_INIT; } + +#endif /* if disabled */ diff --git a/lib/wildcard.h b/lib/wildcard.h index b7826123a..306c8c99f 100644 --- a/lib/wildcard.h +++ b/lib/wildcard.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2010 - 2018, Daniel Stenberg, , et al. + * Copyright (C) 2010 - 2019, 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 @@ -22,8 +22,9 @@ * ***************************************************************************/ -#include +#include "curl_setup.h" +#ifndef CURL_DISABLE_FTP #include "llist.h" /* list of wildcard process states */ @@ -58,4 +59,9 @@ void Curl_wildcard_dtor(struct WildcardData *wc); struct Curl_easy; +#else +/* FTP is disabled */ +#define Curl_wildcard_dtor(x) +#endif + #endif /* HEADER_CURL_WILDCARD_H */ -- cgit v1.2.3