diff options
-rw-r--r-- | lib/ftp.c | 60 | ||||
-rw-r--r-- | lib/ftp.h | 4 | ||||
-rw-r--r-- | lib/ftplistparser.c | 10 | ||||
-rw-r--r-- | lib/wildcard.c | 12 | ||||
-rw-r--r-- | lib/wildcard.h | 8 |
5 files changed, 47 insertions, 47 deletions
@@ -3687,10 +3687,10 @@ CURLcode ftp_perform(struct connectdata *conn, static void wc_data_dtor(void *ptr) { - struct ftp_wc_tmpdata *tmp = ptr; - if(tmp) - Curl_ftp_parselist_data_free(&tmp->parser); - free(tmp); + struct ftp_wc *ftpwc = ptr; + if(ftpwc) + Curl_ftp_parselist_data_free(&ftpwc->parser); + free(ftpwc); } static CURLcode init_wc_data(struct connectdata *conn) @@ -3699,7 +3699,7 @@ static CURLcode init_wc_data(struct connectdata *conn) char *path = conn->data->state.path; struct WildcardData *wildcard = &(conn->data->wildcard); CURLcode result = CURLE_OK; - struct ftp_wc_tmpdata *ftp_tmp; + struct ftp_wc *ftpwc; last_slash = strrchr(conn->data->state.path, '/'); if(last_slash) { @@ -3731,23 +3731,23 @@ static CURLcode init_wc_data(struct connectdata *conn) /* program continues only if URL is not ending with slash, allocate needed resources for wildcard transfer */ - /* allocate ftp protocol specific temporary wildcard data */ - ftp_tmp = calloc(1, sizeof(struct ftp_wc_tmpdata)); - if(!ftp_tmp) { + /* allocate ftp protocol specific wildcard data */ + ftpwc = calloc(1, sizeof(struct ftp_wc)); + if(!ftpwc) { Curl_safefree(wildcard->pattern); return CURLE_OUT_OF_MEMORY; } /* INITIALIZE parselist structure */ - ftp_tmp->parser = Curl_ftp_parselist_data_alloc(); - if(!ftp_tmp->parser) { + ftpwc->parser = Curl_ftp_parselist_data_alloc(); + if(!ftpwc->parser) { Curl_safefree(wildcard->pattern); - free(ftp_tmp); + free(ftpwc); return CURLE_OUT_OF_MEMORY; } - wildcard->tmp = ftp_tmp; /* put it to the WildcardData tmp pointer */ - wildcard->tmp_dtor = wc_data_dtor; + wildcard->protdata = ftpwc; /* put it to the WildcardData tmp pointer */ + wildcard->dtor = wc_data_dtor; /* wildcard does not support NOCWD option (assert it?) */ if(conn->data->set.ftp_filemethod == FTPFILE_NOCWD) @@ -3757,27 +3757,27 @@ static CURLcode init_wc_data(struct connectdata *conn) result = ftp_parse_url_path(conn); if(result) { Curl_safefree(wildcard->pattern); - wildcard->tmp_dtor(wildcard->tmp); - wildcard->tmp_dtor = ZERO_NULL; - wildcard->tmp = NULL; + wildcard->dtor(wildcard->protdata); + wildcard->dtor = ZERO_NULL; + wildcard->protdata = NULL; return result; } wildcard->path = strdup(conn->data->state.path); if(!wildcard->path) { Curl_safefree(wildcard->pattern); - wildcard->tmp_dtor(wildcard->tmp); - wildcard->tmp_dtor = ZERO_NULL; - wildcard->tmp = NULL; + wildcard->dtor(wildcard->protdata); + wildcard->dtor = ZERO_NULL; + wildcard->protdata = NULL; return CURLE_OUT_OF_MEMORY; } /* backup old write_function */ - ftp_tmp->backup.write_function = conn->data->set.fwrite_func; + ftpwc->backup.write_function = conn->data->set.fwrite_func; /* parsing write function */ conn->data->set.fwrite_func = Curl_ftp_parselist; /* backup old file descriptor */ - ftp_tmp->backup.file_descriptor = conn->data->set.out; + ftpwc->backup.file_descriptor = conn->data->set.out; /* let the writefunc callback know what curl pointer is working with */ conn->data->set.out = conn; @@ -3803,14 +3803,14 @@ static CURLcode wc_statemach(struct connectdata *conn) case CURLWC_MATCHING: { /* In this state is LIST response successfully parsed, so lets restore previous WRITEFUNCTION callback and WRITEDATA pointer */ - struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp; - conn->data->set.fwrite_func = ftp_tmp->backup.write_function; - conn->data->set.out = ftp_tmp->backup.file_descriptor; - ftp_tmp->backup.write_function = ZERO_NULL; - ftp_tmp->backup.file_descriptor = NULL; + struct ftp_wc *ftpwc = wildcard->protdata; + conn->data->set.fwrite_func = ftpwc->backup.write_function; + conn->data->set.out = ftpwc->backup.file_descriptor; + ftpwc->backup.write_function = ZERO_NULL; + ftpwc->backup.file_descriptor = NULL; wildcard->state = CURLWC_DOWNLOADING; - if(Curl_ftp_parselist_geterror(ftp_tmp->parser)) { + if(Curl_ftp_parselist_geterror(ftpwc->parser)) { /* error found in LIST parsing */ wildcard->state = CURLWC_CLEAN; return wc_statemach(conn); @@ -3892,10 +3892,10 @@ static CURLcode wc_statemach(struct connectdata *conn) } case CURLWC_CLEAN: { - struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp; + struct ftp_wc *ftpwc = wildcard->protdata; result = CURLE_OK; - if(ftp_tmp) - result = Curl_ftp_parselist_geterror(ftp_tmp->parser); + if(ftpwc) + result = Curl_ftp_parselist_geterror(ftpwc->parser); wildcard->state = result ? CURLWC_ERROR : CURLWC_DONE; } break; @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -81,7 +81,7 @@ typedef enum { struct ftp_parselist_data; /* defined later in ftplistparser.c */ -struct ftp_wc_tmpdata { +struct ftp_wc { struct ftp_parselist_data *parser; struct { diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c index 7668ea8c8..813e954c7 100644 --- a/lib/ftplistparser.c +++ b/lib/ftplistparser.c @@ -270,9 +270,9 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata *conn, { curl_fnmatch_callback compare; struct WildcardData *wc = &conn->data->wildcard; - struct ftp_wc_tmpdata *tmpdata = wc->tmp; + struct ftp_wc *ftpwc = wc->protdata; struct curl_llist *llist = &wc->filelist; - struct ftp_parselist_data *parser = tmpdata->parser; + struct ftp_parselist_data *parser = ftpwc->parser; bool add = TRUE; struct curl_fileinfo *finfo = &infop->info; @@ -316,7 +316,7 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata *conn, Curl_fileinfo_dtor(NULL, finfo); } - tmpdata->parser->file_data = NULL; + ftpwc->parser->file_data = NULL; return CURLE_OK; } @@ -325,8 +325,8 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, { size_t bufflen = size*nmemb; struct connectdata *conn = (struct connectdata *)connptr; - struct ftp_wc_tmpdata *tmpdata = conn->data->wildcard.tmp; - struct ftp_parselist_data *parser = tmpdata->parser; + struct ftp_wc *ftpwc = conn->data->wildcard.protdata; + struct ftp_parselist_data *parser = ftpwc->parser; struct fileinfo *infop; struct curl_fileinfo *finfo; unsigned long i = 0; diff --git a/lib/wildcard.c b/lib/wildcard.c index af45c79bd..cb88ab72f 100644 --- a/lib/wildcard.c +++ b/lib/wildcard.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -43,12 +43,12 @@ void Curl_wildcard_dtor(struct WildcardData *wc) if(!wc) return; - if(wc->tmp_dtor) { - wc->tmp_dtor(wc->tmp); - wc->tmp_dtor = ZERO_NULL; - wc->tmp = NULL; + if(wc->dtor) { + wc->dtor(wc->protdata); + wc->dtor = ZERO_NULL; + wc->protdata = NULL; } - DEBUGASSERT(wc->tmp == NULL); + DEBUGASSERT(wc->protdata == NULL); Curl_llist_destroy(&wc->filelist, NULL); diff --git a/lib/wildcard.h b/lib/wildcard.h index 8a5e4b769..b7826123a 100644 --- a/lib/wildcard.h +++ b/lib/wildcard.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2010 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2010 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,7 +40,7 @@ typedef enum { will end */ } curl_wildcard_states; -typedef void (*curl_wildcard_tmp_dtor)(void *ptr); +typedef void (*curl_wildcard_dtor)(void *ptr); /* struct keeping information about wildcard download process */ struct WildcardData { @@ -48,8 +48,8 @@ struct WildcardData { char *path; /* path to the directory, where we trying wildcard-match */ char *pattern; /* wildcard pattern */ struct curl_llist filelist; /* llist with struct Curl_fileinfo */ - void *tmp; /* pointer to protocol specific temporary data */ - curl_wildcard_tmp_dtor tmp_dtor; + void *protdata; /* pointer to protocol specific temporary data */ + curl_wildcard_dtor dtor; void *customptr; /* for CURLOPT_CHUNK_DATA pointer */ }; |