ftp: allocate the wildcard struct on demand

The feature is rarely used so this frees up data for the vast majority
of easy handles that don't use it.

Rename "protdata" to "ftpwc" since it is always an FTP wildcard struct
pointer. Made the state struct field an unsigned char to save space.

Closes #10639
This commit is contained in:
Daniel Stenberg 2023-02-27 23:57:23 +01:00
parent c84c0f9aa3
commit 9c188e771c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 33 additions and 24 deletions

View file

@ -274,8 +274,8 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data,
struct fileinfo *infop)
{
curl_fnmatch_callback compare;
struct WildcardData *wc = &data->wildcard;
struct ftp_wc *ftpwc = wc->protdata;
struct WildcardData *wc = data->wildcard;
struct ftp_wc *ftpwc = wc->ftpwc;
struct Curl_llist *llist = &wc->filelist;
struct ftp_parselist_data *parser = ftpwc->parser;
bool add = TRUE;
@ -330,7 +330,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
{
size_t bufflen = size*nmemb;
struct Curl_easy *data = (struct Curl_easy *)connptr;
struct ftp_wc *ftpwc = data->wildcard.protdata;
struct ftp_wc *ftpwc = data->wildcard->ftpwc;
struct ftp_parselist_data *parser = ftpwc->parser;
struct fileinfo *infop;
struct curl_fileinfo *finfo;