diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-12-19 20:29:56 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-12-20 12:38:31 +0000 |
commit | f2a5283cbcd564518d4189630ab26ce739bf67b1 (patch) | |
tree | 1c7549534ccdbb8b6da59972def30d6a2fe86581 | |
parent | 3e1625c78710a911b4c3980824080f65b895f2c8 (diff) |
non-ascii: Reduce variable scope
As 'result' isn't used out side the conversion callback code and
previously caused variable shadowing in the libiconv based code.
-rw-r--r-- | lib/non-ascii.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/non-ascii.c b/lib/non-ascii.c index bfe065054..ef6a82cea 100644 --- a/lib/non-ascii.c +++ b/lib/non-ascii.c @@ -82,16 +82,15 @@ CURLcode Curl_convert_clone(struct SessionHandle *data, CURLcode Curl_convert_to_network(struct SessionHandle *data, char *buffer, size_t length) { - CURLcode result; - if(data->set.convtonetwork) { /* use translation callback */ - result = data->set.convtonetwork(buffer, length); + CURLcode result = data->set.convtonetwork(buffer, length); if(result) { failf(data, "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s", (int)result, curl_easy_strerror(result)); } + return result; } else { @@ -143,16 +142,15 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data, CURLcode Curl_convert_from_network(struct SessionHandle *data, char *buffer, size_t length) { - CURLcode result; - if(data->set.convfromnetwork) { /* use translation callback */ - result = data->set.convfromnetwork(buffer, length); + CURLcode result = data->set.convfromnetwork(buffer, length); if(result) { failf(data, "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s", (int)result, curl_easy_strerror(result)); } + return result; } else { @@ -204,16 +202,15 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data, CURLcode Curl_convert_from_utf8(struct SessionHandle *data, char *buffer, size_t length) { - CURLcode result; - if(data->set.convfromutf8) { /* use translation callback */ - result = data->set.convfromutf8(buffer, length); + CURLcode result = data->set.convfromutf8(buffer, length); if(result) { failf(data, "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s", (int)result, curl_easy_strerror(result)); } + return result; } else { |