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:
Daniel Stenberg 2025-08-07 23:11:10 +02:00
parent 065a653158
commit da27db068f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 204 additions and 252 deletions

View file

@ -52,6 +52,7 @@ struct OperationConfig *config_alloc(void)
config->ftp_skip_ip = TRUE;
config->file_clobber_mode = CLOBBER_DEFAULT;
config->upload_flags = CURLULFLAG_SEEN;
config->retry_delay_ms = RETRY_SLEEP_DEFAULT;
curlx_dyn_init(&config->postdata, MAX_FILE2MEMORY);
return config;
}