diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-02-28 09:22:46 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-03-03 23:25:30 +0100 |
commit | 56d5c07bbb0fc774c05f0ad5d1322914ac5c7b67 (patch) | |
tree | 409a31c5607c331490d9df5a82b73edee4c4f415 /lib/ftplistparser.c | |
parent | 9c188e771c9d5ecbdb04cbc9f3936bb9f52f78c9 (diff) | |
download | curl-56d5c07bbb0fc774c05f0ad5d1322914ac5c7b67.tar.gz |
wildcard: remove files and move functions into ftplistparser.c
Diffstat (limited to 'lib/ftplistparser.c')
-rw-r--r-- | lib/ftplistparser.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c index 4d6698b9a..39001e3f6 100644 --- a/lib/ftplistparser.c +++ b/lib/ftplistparser.c @@ -181,6 +181,43 @@ struct ftp_parselist_data { } offsets; }; +static void fileinfo_dtor(void *user, void *element) +{ + (void)user; + Curl_fileinfo_cleanup(element); +} + +CURLcode Curl_wildcard_init(struct WildcardData *wc) +{ + Curl_llist_init(&wc->filelist, fileinfo_dtor); + wc->state = CURLWC_INIT; + + return CURLE_OK; +} + +void Curl_wildcard_dtor(struct WildcardData **wcp) +{ + struct WildcardData *wc = *wcp; + if(!wc) + return; + + if(wc->dtor) { + wc->dtor(wc->ftpwc); + wc->dtor = ZERO_NULL; + wc->ftpwc = NULL; + } + DEBUGASSERT(wc->ftpwc == NULL); + + Curl_llist_destroy(&wc->filelist, NULL); + free(wc->path); + wc->path = NULL; + free(wc->pattern); + wc->pattern = NULL; + wc->state = CURLWC_INIT; + free(wc); + *wcp = NULL; +} + struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void) { return calloc(1, sizeof(struct ftp_parselist_data)); |