protocol: introduce typedef for the do_more() function

Instead of using magic values -1, 0 and -1 using enum.

Closes #21509
This commit is contained in:
Daniel Stenberg 2026-05-05 18:39:12 +02:00
parent 2c81cf620e
commit e0df43b9d3
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 36 additions and 23 deletions

View file

@ -1773,16 +1773,16 @@ static CURLcode multi_do(struct Curl_easy *data, bool *done)
* stage DO state which (wrongly) was introduced to support FTP's second
* connection.
*
* 'complete' can return 0 for incomplete, 1 for done and -1 for go back to
* DOING state there is more work to do!
* 'complete' can return DOMORE_INCOMPLETE, DOMORE_DONE or DOMORE_GOBACK
* (to DOING state when there is more work to do)
*/
static CURLcode multi_do_more(struct Curl_easy *data, int *complete)
static CURLcode multi_do_more(struct Curl_easy *data, domore *complete)
{
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
*complete = 0;
*complete = DOMORE_INCOMPLETE;
if(conn->scheme->run->do_more)
result = conn->scheme->run->do_more(data, complete);
@ -2596,7 +2596,7 @@ static CURLMcode multistate_doing_more(struct Curl_easy *data,
bool *stream_error,
CURLcode *result)
{
int control;
domore control;
/*
* When we are connected, DOING MORE and then go DID
@ -2605,10 +2605,10 @@ static CURLMcode multistate_doing_more(struct Curl_easy *data,
*result = multi_do_more(data, &control);
if(!(*result)) {
if(control) {
/* if positive, advance to DO_DONE
if negative, go back to DOING */
multistate(data, control == 1 ? MSTATE_DID : MSTATE_DOING);
if(control != DOMORE_INCOMPLETE) {
/* if DONE, advance to DO_DONE
if GOBACK, go back to DOING */
multistate(data, control == DOMORE_DONE ? MSTATE_DID : MSTATE_DOING);
return CURLM_CALL_MULTI_PERFORM;
}
/* else