failf: skip the sprintf() if there are no consumers

Closes #1936
This commit is contained in:
Daniel Stenberg 2017-10-03 14:26:36 +02:00
parent a69a4d222d
commit 120d963a64
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 17 additions and 17 deletions

View File

@ -241,11 +241,11 @@ void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
{
if(data->set.verbose || data->set.errorbuffer) {
va_list ap;
size_t len;
char error[CURL_ERROR_SIZE + 2];
va_start(ap, fmt);
vsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
len = strlen(error);
@ -258,8 +258,8 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
error[++len] = '\0';
Curl_debug(data, CURLINFO_TEXT, error, len, NULL);
}
va_end(ap);
}
}
/* Curl_sendf() sends formatted data to the server */