diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2017-06-19 00:52:38 -0400 |
---|---|---|
committer | ng0 <ng0@infotropique.org> | 2017-08-22 15:29:42 +0000 |
commit | 68664dc52dab17bf71ce7f5823dbf3c5e409d108 (patch) | |
tree | 39e46889b6145fb4b946a9e8ef6386235e308549 /lib/non-ascii.c | |
parent | 72f7738987ebefc46787a66ce9c9b966422e9c3b (diff) | |
download | gnurl-68664dc52dab17bf71ce7f5823dbf3c5e409d108.tar.gz gnurl-68664dc52dab17bf71ce7f5823dbf3c5e409d108.tar.bz2 gnurl-68664dc52dab17bf71ce7f5823dbf3c5e409d108.zip |
curl_setup_once: Remove ERRNO/SET_ERRNO macros
Prior to this change (SET_)ERRNO mapped to GetLastError/SetLastError
for Win32 and regular errno otherwise.
I reviewed the code and found no justifiable reason for conflating errno
on WIN32 with GetLastError/SetLastError. All Win32 CRTs support errno,
and any Win32 multithreaded CRT supports thread-local errno.
Fixes https://github.com/curl/curl/issues/895
Closes https://github.com/curl/curl/pull/1589
Diffstat (limited to 'lib/non-ascii.c')
-rw-r--r-- | lib/non-ascii.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/non-ascii.c b/lib/non-ascii.c index 2f5de4c68..ae0097036 100644 --- a/lib/non-ascii.c +++ b/lib/non-ascii.c @@ -98,19 +98,17 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data, /* do the translation ourselves */ char *input_ptr, *output_ptr; size_t in_bytes, out_bytes, rc; - int error; /* open an iconv conversion descriptor if necessary */ if(data->outbound_cd == (iconv_t)-1) { data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK, CURL_ICONV_CODESET_OF_HOST); if(data->outbound_cd == (iconv_t)-1) { - error = ERRNO; failf(data, "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", CURL_ICONV_CODESET_OF_NETWORK, CURL_ICONV_CODESET_OF_HOST, - error, strerror(error)); + errno, strerror(errno)); return CURLE_CONV_FAILED; } } @@ -120,10 +118,9 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data, rc = iconv(data->outbound_cd, (const char **)&input_ptr, &in_bytes, &output_ptr, &out_bytes); if((rc == ICONV_ERROR) || (in_bytes != 0)) { - error = ERRNO; failf(data, "The Curl_convert_to_network iconv call failed with errno %i: %s", - error, strerror(error)); + errno, strerror(errno)); return CURLE_CONV_FAILED; } #else @@ -158,19 +155,17 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data, /* do the translation ourselves */ char *input_ptr, *output_ptr; size_t in_bytes, out_bytes, rc; - int error; /* open an iconv conversion descriptor if necessary */ if(data->inbound_cd == (iconv_t)-1) { data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_NETWORK); if(data->inbound_cd == (iconv_t)-1) { - error = ERRNO; failf(data, "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_NETWORK, - error, strerror(error)); + errno, strerror(errno)); return CURLE_CONV_FAILED; } } @@ -180,10 +175,9 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data, rc = iconv(data->inbound_cd, (const char **)&input_ptr, &in_bytes, &output_ptr, &out_bytes); if((rc == ICONV_ERROR) || (in_bytes != 0)) { - error = ERRNO; failf(data, "Curl_convert_from_network iconv call failed with errno %i: %s", - error, strerror(error)); + errno, strerror(errno)); return CURLE_CONV_FAILED; } #else @@ -219,19 +213,17 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data, const char *input_ptr; char *output_ptr; size_t in_bytes, out_bytes, rc; - int error; /* open an iconv conversion descriptor if necessary */ if(data->utf8_cd == (iconv_t)-1) { data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_FOR_UTF8); if(data->utf8_cd == (iconv_t)-1) { - error = ERRNO; failf(data, "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_FOR_UTF8, - error, strerror(error)); + errno, strerror(errno)); return CURLE_CONV_FAILED; } } @@ -241,10 +233,9 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data, rc = iconv(data->utf8_cd, &input_ptr, &in_bytes, &output_ptr, &out_bytes); if((rc == ICONV_ERROR) || (in_bytes != 0)) { - error = ERRNO; failf(data, "The Curl_convert_from_utf8 iconv call failed with errno %i: %s", - error, strerror(error)); + errno, strerror(errno)); return CURLE_CONV_FAILED; } if(output_ptr < input_ptr) { |