mirror of
https://github.com/curl/curl.git
synced 2026-08-01 08:08:04 +03:00
tool_operate: cleanups
- move the state struct from config to global. It is used as a single instance anyway so might as well be a single one to save memory. - simplify and combine several conditions - set default retry delay inititally - use better struct field names to make it easier to understand their purposes - remove the state->outfiles field as it was not necessary - remove superfluous glob cleanup call - move conditions around to remove an indent level - move the ->url NULL check Takes single_transfer()'s complexity score down from 78 to 68. Closes #18226
This commit is contained in:
parent
065a653158
commit
da27db068f
5 changed files with 204 additions and 252 deletions
|
|
@ -68,17 +68,15 @@ struct State {
|
|||
struct getout *urlnode;
|
||||
struct URLGlob inglob;
|
||||
struct URLGlob urlglob;
|
||||
char *outfiles;
|
||||
char *httpgetfields;
|
||||
char *uploadfile;
|
||||
curl_off_t infilenum; /* number of files to upload */
|
||||
curl_off_t up; /* upload file counter within a single upload glob */
|
||||
curl_off_t upnum; /* number of files to upload */
|
||||
curl_off_t upidx; /* index for upload glob */
|
||||
curl_off_t urlnum; /* how many iterations this URL has with ranges etc */
|
||||
curl_off_t li; /* index for globbed URLs */
|
||||
curl_off_t urlidx; /* index for globbed URLs */
|
||||
};
|
||||
|
||||
struct OperationConfig {
|
||||
struct State state; /* for create_transfer() */
|
||||
struct dynbuf postdata;
|
||||
char *useragent;
|
||||
struct curl_slist *cookies; /* cookies to serialize into a single line */
|
||||
|
|
@ -342,6 +340,7 @@ struct OperationConfig {
|
|||
};
|
||||
|
||||
struct GlobalConfig {
|
||||
struct State state; /* for create_transfer() */
|
||||
char *trace_dump; /* file to dump the network trace to */
|
||||
FILE *trace_stream;
|
||||
char *libcurl; /* Output libcurl code to this filename */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue