From: Viktor Szakats Date: Tue, 3 Sep 2024 19:22:04 +0000 (+0200) Subject: src: namespace symbols clashing with lib X-Git-Tag: curl-8_10_0~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32eee8f139015dc87dfd6282fc8ce604904b94b1;p=thirdparty%2Fcurl.git src: namespace symbols clashing with lib Before this patch `lib/http.h` and `src/tool_sdecls.h` both declared `HTTPREQ_*` enums. Rename `src` ones to have distinct names. They are not included in the same code for now, but this may change when bundling unit/libtests into single programs. Closes #14785 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index d044e8386b..be41aa35d5 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -2165,7 +2165,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ &config->mimecurrent, (cmd == C_FORM_STRING)?TRUE:FALSE)) /* literal string */ err = PARAM_BAD_USE; - else if(SetHTTPrequest(config, HTTPREQ_MIMEPOST, &config->httpreq)) + else if(SetHTTPrequest(config, TOOL_HTTPREQ_MIMEPOST, &config->httpreq)) err = PARAM_BAD_USE; break; case C_GLOBOFF: /* --globoff */ @@ -2243,7 +2243,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ config->no_body = toggle; config->show_headers = toggle; if(SetHTTPrequest(config, - (config->no_body)?HTTPREQ_HEAD:HTTPREQ_GET, + (config->no_body)?TOOL_HTTPREQ_HEAD:TOOL_HTTPREQ_GET, &config->httpreq)) err = PARAM_BAD_USE; break; diff --git a/src/tool_helpers.c b/src/tool_helpers.c index ac38a15c20..2e15144b7b 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -94,7 +94,7 @@ int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store) "PUT (-T, --upload-file)" }; - if((*store == HTTPREQ_UNSPEC) || + if((*store == TOOL_HTTPREQ_UNSPEC) || (*store == req)) { *store = req; return 0; diff --git a/src/tool_operate.c b/src/tool_operate.c index 05d0420f23..41fd6718c8 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -840,14 +840,14 @@ static CURLcode single_transfer(struct GlobalConfig *global, httpgetfields = state->httpgetfields = config->postfields; config->postfields = NULL; if(SetHTTPrequest(config, - (config->no_body?HTTPREQ_HEAD:HTTPREQ_GET), + (config->no_body?TOOL_HTTPREQ_HEAD:TOOL_HTTPREQ_GET), &config->httpreq)) { result = CURLE_FAILED_INIT; } } } else { - if(SetHTTPrequest(config, HTTPREQ_SIMPLEPOST, &config->httpreq)) + if(SetHTTPrequest(config, TOOL_HTTPREQ_SIMPLEPOST, &config->httpreq)) result = CURLE_FAILED_INIT; } if(result) { @@ -1051,7 +1051,7 @@ static CURLcode single_transfer(struct GlobalConfig *global, result = CURLE_OUT_OF_MEMORY; break; } - if(SetHTTPrequest(config, HTTPREQ_PUT, &config->httpreq)) { + if(SetHTTPrequest(config, TOOL_HTTPREQ_PUT, &config->httpreq)) { Curl_safefree(per->uploadfile); curl_easy_cleanup(curl); result = CURLE_FAILED_INIT; @@ -1521,7 +1521,7 @@ static CURLcode single_transfer(struct GlobalConfig *global, my_setopt(curl, CURLOPT_TIMEOUT_MS, config->timeout_ms); switch(config->httpreq) { - case HTTPREQ_SIMPLEPOST: + case TOOL_HTTPREQ_SIMPLEPOST: if(config->resume_from) { errorf(global, "cannot mix --continue-at with --data"); result = CURLE_FAILED_INIT; @@ -1533,7 +1533,7 @@ static CURLcode single_transfer(struct GlobalConfig *global, (curl_off_t)curlx_dyn_len(&config->postdata)); } break; - case HTTPREQ_MIMEPOST: + case TOOL_HTTPREQ_MIMEPOST: /* free previous remainders */ curl_mime_free(config->mimepost); config->mimepost = NULL; diff --git a/src/tool_sdecls.h b/src/tool_sdecls.h index 2d83adb8f9..2dee9d3149 100644 --- a/src/tool_sdecls.h +++ b/src/tool_sdecls.h @@ -114,12 +114,12 @@ typedef enum { */ typedef enum { - HTTPREQ_UNSPEC, /* first in list */ - HTTPREQ_GET, - HTTPREQ_HEAD, - HTTPREQ_MIMEPOST, - HTTPREQ_SIMPLEPOST, - HTTPREQ_PUT + TOOL_HTTPREQ_UNSPEC, /* first in list */ + TOOL_HTTPREQ_GET, + TOOL_HTTPREQ_HEAD, + TOOL_HTTPREQ_MIMEPOST, + TOOL_HTTPREQ_SIMPLEPOST, + TOOL_HTTPREQ_PUT } HttpReq;