lib, src: delete stray curl_ prefix from printf calls

Also:
- unit1398: delete redundant `curl/mprintf.h` include.

Closes #14664
This commit is contained in:
Viktor Szakats 2024-08-23 14:44:16 +02:00
parent 8b09138083
commit 573e7e827e
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
9 changed files with 62 additions and 64 deletions

View File

@ -271,7 +271,7 @@ static CURLcode make_headers(struct Curl_easy *data,
if(!tmp_head)
goto fail;
head = tmp_head;
*date_header = curl_maprintf("%s: %s\r\n", date_hdr_key, timestamp);
*date_header = aprintf("%s: %s\r\n", date_hdr_key, timestamp);
}
else {
char *value;
@ -766,19 +766,19 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
result = CURLE_OUT_OF_MEMORY;
canonical_request =
curl_maprintf("%s\n" /* HTTPRequestMethod */
"%s\n" /* CanonicalURI */
"%s\n" /* CanonicalQueryString */
"%s\n" /* CanonicalHeaders */
"%s\n" /* SignedHeaders */
"%.*s", /* HashedRequestPayload in hex */
method,
Curl_dyn_ptr(&canonical_path),
Curl_dyn_ptr(&canonical_query) ?
Curl_dyn_ptr(&canonical_query) : "",
Curl_dyn_ptr(&canonical_headers),
Curl_dyn_ptr(&signed_headers),
(int)payload_hash_len, payload_hash);
aprintf("%s\n" /* HTTPRequestMethod */
"%s\n" /* CanonicalURI */
"%s\n" /* CanonicalQueryString */
"%s\n" /* CanonicalHeaders */
"%s\n" /* SignedHeaders */
"%.*s", /* HashedRequestPayload in hex */
method,
Curl_dyn_ptr(&canonical_path),
Curl_dyn_ptr(&canonical_query) ?
Curl_dyn_ptr(&canonical_query) : "",
Curl_dyn_ptr(&canonical_headers),
Curl_dyn_ptr(&signed_headers),
(int)payload_hash_len, payload_hash);
if(!canonical_request)
goto fail;
@ -786,12 +786,12 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
/* provider 0 lowercase */
Curl_strntolower(provider0, provider0, strlen(provider0));
request_type = curl_maprintf("%s4_request", provider0);
request_type = aprintf("%s4_request", provider0);
if(!request_type)
goto fail;
credential_scope = curl_maprintf("%s/%s/%s/%s",
date, region, service, request_type);
credential_scope = aprintf("%s/%s/%s/%s",
date, region, service, request_type);
if(!credential_scope)
goto fail;
@ -808,22 +808,22 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
* Google allows using RSA key instead of HMAC, so this code might change
* in the future. For now we only support HMAC.
*/
str_to_sign = curl_maprintf("%s4-HMAC-SHA256\n" /* Algorithm */
"%s\n" /* RequestDateTime */
"%s\n" /* CredentialScope */
"%s", /* HashedCanonicalRequest in hex */
provider0,
timestamp,
credential_scope,
sha_hex);
str_to_sign = aprintf("%s4-HMAC-SHA256\n" /* Algorithm */
"%s\n" /* RequestDateTime */
"%s\n" /* CredentialScope */
"%s", /* HashedCanonicalRequest in hex */
provider0,
timestamp,
credential_scope,
sha_hex);
if(!str_to_sign) {
goto fail;
}
/* provider 0 uppercase */
secret = curl_maprintf("%s4%s", provider0,
data->state.aptr.passwd ?
data->state.aptr.passwd : "");
secret = aprintf("%s4%s", provider0,
data->state.aptr.passwd ?
data->state.aptr.passwd : "");
if(!secret)
goto fail;
@ -836,24 +836,24 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
sha256_to_hex(sha_hex, sign0);
/* provider 0 uppercase */
auth_headers = curl_maprintf("Authorization: %s4-HMAC-SHA256 "
"Credential=%s/%s, "
"SignedHeaders=%s, "
"Signature=%s\r\n"
/*
* date_header is added here, only if it was not
* user-specified (using CURLOPT_HTTPHEADER).
* date_header includes \r\n
*/
"%s"
"%s", /* optional sha256 header includes \r\n */
provider0,
user,
credential_scope,
Curl_dyn_ptr(&signed_headers),
sha_hex,
date_header ? date_header : "",
content_sha256_hdr);
auth_headers = aprintf("Authorization: %s4-HMAC-SHA256 "
"Credential=%s/%s, "
"SignedHeaders=%s, "
"Signature=%s\r\n"
/*
* date_header is added here, only if it was not
* user-specified (using CURLOPT_HTTPHEADER).
* date_header includes \r\n
*/
"%s"
"%s", /* optional sha256 header includes \r\n */
provider0,
user,
credential_scope,
Curl_dyn_ptr(&signed_headers),
sha_hex,
date_header ? date_header : "",
content_sha256_hdr);
if(!auth_headers) {
goto fail;
}

View File

@ -1680,7 +1680,7 @@ CURLcode Curl_mime_add_header(struct curl_slist **slp, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
s = curl_mvaprintf(fmt, ap);
s = vaprintf(fmt, ap);
va_end(ap);
if(s) {

View File

@ -324,7 +324,7 @@ int Curl_parsenetrc(const char *host, char **loginp, char **passwordp,
return retcode; /* no home directory found (or possibly out of
memory) */
filealloc = curl_maprintf("%s%s.netrc", home, DIR_CHAR);
filealloc = aprintf("%s%s.netrc", home, DIR_CHAR);
if(!filealloc) {
free(homea);
return -1;
@ -334,7 +334,7 @@ int Curl_parsenetrc(const char *host, char **loginp, char **passwordp,
#ifdef _WIN32
if(retcode == NETRC_FILE_MISSING) {
/* fallback to the old-style "_netrc" file */
filealloc = curl_maprintf("%s%s_netrc", home, DIR_CHAR);
filealloc = aprintf("%s%s_netrc", home, DIR_CHAR);
if(!filealloc) {
free(homea);
return -1;

View File

@ -96,7 +96,7 @@ bool tool_create_output_file(struct OutStruct *outs,
(errno == EEXIST || errno == EISDIR) &&
/* because we keep having files that already exist */
next_num < 100 /* and we have not reached the retry limit */ ) {
curl_msnprintf(newname + len + 1, 12, "%d", next_num);
msnprintf(newname + len + 1, 12, "%d", next_num);
next_num++;
do {
fd = open(newname, O_CREAT | O_WRONLY | O_EXCL | O_BINARY, OPENMODE);

View File

@ -111,7 +111,7 @@ CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...)
char *bufp;
va_list ap;
va_start(ap, fmt);
bufp = curl_mvaprintf(fmt, ap);
bufp = vaprintf(fmt, ap);
va_end(ap);
if(!bufp) {
ret = CURLE_OUT_OF_MEMORY;

View File

@ -35,7 +35,7 @@
#include <fcntl.h>
#endif
#include <curl/mprintf.h>
#include <curlx.h>
#include "tool_findfile.h"
@ -72,9 +72,9 @@ static char *checkhome(const char *home, const char *fname, bool dotscore)
for(i = 0; i < (dotscore ? 2 : 1); i++) {
char *c;
if(dotscore)
c = curl_maprintf("%s" DIR_CHAR "%c%s", home, pref[i], &fname[1]);
c = aprintf("%s" DIR_CHAR "%c%s", home, pref[i], &fname[1]);
else
c = curl_maprintf("%s" DIR_CHAR "%s", home, fname);
c = aprintf("%s" DIR_CHAR "%s", home, fname);
if(c) {
int fd = open(c, O_RDONLY);
if(fd >= 0) {
@ -118,7 +118,7 @@ char *findfile(const char *fname, int dotscore)
continue;
}
if(conf_list[i].append) {
char *c = curl_maprintf("%s%s", home, conf_list[i].append);
char *c = aprintf("%s%s", home, conf_list[i].append);
curl_free(home);
if(!c)
return NULL;

View File

@ -53,7 +53,7 @@ static void voutf(struct GlobalConfig *config,
char *ptr;
char *print_buffer;
print_buffer = curl_mvaprintf(fmt, ap);
print_buffer = vaprintf(fmt, ap);
if(!print_buffer)
return;
len = strlen(print_buffer);

View File

@ -557,13 +557,13 @@ static CURLcode checkpasswd(const char *kind, /* for what purpose */
/* build a nice-looking prompt */
if(!i && last)
curl_msnprintf(prompt, sizeof(prompt),
"Enter %s password for user '%s':",
kind, *userpwd);
msnprintf(prompt, sizeof(prompt),
"Enter %s password for user '%s':",
kind, *userpwd);
else
curl_msnprintf(prompt, sizeof(prompt),
"Enter %s password for user '%s' on URL #%zu:",
kind, *userpwd, i + 1);
msnprintf(prompt, sizeof(prompt),
"Enter %s password for user '%s' on URL #%zu:",
kind, *userpwd, i + 1);
/* get password */
getpass_r(prompt, passwd, sizeof(passwd));

View File

@ -25,8 +25,6 @@
#include "curlcheck.h"
#include "curl/mprintf.h"
static CURLcode unit_setup(void) {return CURLE_OK;}
static void unit_stop(void) {}