summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2019-05-25 10:06:08 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2019-06-05 20:38:06 +0200
commite23c52b3295a525fbaae9e7ed3e7061fea6dffc2 (patch)
tree4a74cf5ed3496a6126f1cc7c4284b6620108db06 /packages
parent04ac54e1965041684fc1b6532eba90f58601264e (diff)
downloadcurl-e23c52b3295a525fbaae9e7ed3e7061fea6dffc2.tar.gz
build: fix Codacy warnings
Reduce variable scopes and remove redundant variable stores. Closes https://github.com/curl/curl/pull/3975
Diffstat (limited to 'packages')
-rw-r--r--packages/OS400/ccsidcurl.c17
-rw-r--r--packages/OS400/os400sys.c19
2 files changed, 15 insertions, 21 deletions
diff --git a/packages/OS400/ccsidcurl.c b/packages/OS400/ccsidcurl.c
index fd3b5f073..39a1f99b5 100644
--- a/packages/OS400/ccsidcurl.c
+++ b/packages/OS400/ccsidcurl.c
@@ -620,12 +620,7 @@ curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
va_list arg;
void *paramp;
CURLcode ret;
- unsigned int ccsid;
- char * * cpp;
struct Curl_easy * data;
- struct curl_slist * * slp;
- struct curl_certinfo * cipf;
- struct curl_certinfo * cipt;
/* WARNING: unlike curl_easy_getinfo(), the strings returned by this
procedure have to be free'ed. */
@@ -635,7 +630,13 @@ curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
paramp = va_arg(arg, void *);
ret = Curl_getinfo(data, info, paramp);
- if(ret == CURLE_OK)
+ if(ret == CURLE_OK) {
+ unsigned int ccsid;
+ char **cpp;
+ struct curl_slist **slp;
+ struct curl_certinfo *cipf;
+ struct curl_certinfo *cipt;
+
switch((int) info & CURLINFO_TYPEMASK) {
case CURLINFO_STRING:
@@ -706,6 +707,7 @@ curl_easy_getinfo_ccsid(CURL *curl, CURLINFO info, ...)
break;
}
}
+ }
va_end(arg);
return ret;
@@ -1355,13 +1357,12 @@ curl_pushheader_byname_ccsid(struct curl_pushheaders *h, const char *header,
{
char *d = (char *) NULL;
- char *s;
if(header) {
header = dynconvert(ASCII_CCSID, header, -1, ccsidin);
if(header) {
- s = curl_pushheader_byname(h, header);
+ char *s = curl_pushheader_byname(h, header);
free((char *) header);
if(s)
diff --git a/packages/OS400/os400sys.c b/packages/OS400/os400sys.c
index 84bc10abd..67b34a84c 100644
--- a/packages/OS400/os400sys.c
+++ b/packages/OS400/os400sys.c
@@ -268,13 +268,9 @@ Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen,
int flags)
{
- char * enodename;
- char * eservname;
+ char *enodename = NULL;
+ char *eservname = NULL;
int status;
- int i;
-
- enodename = (char *) NULL;
- eservname = (char *) NULL;
if(nodename && nodenamelen) {
enodename = malloc(nodenamelen);
@@ -294,6 +290,7 @@ Curl_getnameinfo_a(const struct sockaddr * sa, curl_socklen_t salen,
eservname, servnamelen, flags);
if(!status) {
+ int i;
if(enodename) {
i = QadrtConvertE2A(nodename, enodename,
nodenamelen - 1, strlen(enodename));
@@ -766,16 +763,13 @@ static int
Curl_gss_convert_in_place(OM_uint32 * minor_status, gss_buffer_t buf)
{
- unsigned int i;
- char * t;
+ unsigned int i = buf->length;
/* Convert `buf' in place, from EBCDIC to ASCII.
If error, release the buffer and return -1. Else return 0. */
- i = buf->length;
-
if(i) {
- t = malloc(i);
+ char *t = malloc(i);
if(!t) {
gss_release_buffer(minor_status, buf);
@@ -865,7 +859,6 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
{
int rc;
- unsigned int i;
gss_buffer_desc in;
gss_buffer_t inp;
@@ -874,7 +867,7 @@ Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
if(inp) {
if(inp->length && inp->value) {
- i = inp->length;
+ unsigned int i = inp->length;
in.value = malloc(i + 1);
if(!in.value) {