summaryrefslogtreecommitdiff
path: root/src/tool_parsecfg.c
diff options
context:
space:
mode:
authorMarian Klymov <nekto1989@gmail.com>2018-06-02 23:52:56 +0300
committerDaniel Stenberg <daniel@haxx.se>2018-06-11 11:14:48 +0200
commitc45360d4633850839bb9c2d77dbf8a8285e9ad49 (patch)
tree20159c553a74ed98c2431fc8f2852067f79ac4e9 /src/tool_parsecfg.c
parent38203f1585da53e07e54e37c7d5da4d72f509a2e (diff)
downloadcurl-c45360d4633850839bb9c2d77dbf8a8285e9ad49.tar.gz
cppcheck: fix warnings
- Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
Diffstat (limited to 'src/tool_parsecfg.c')
-rw-r--r--src/tool_parsecfg.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index 540bdb18a..34b5d8b25 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -46,11 +46,9 @@ static char *my_get_line(FILE *fp);
/* return 0 on everything-is-fine, and non-zero otherwise */
int parseconfig(const char *filename, struct GlobalConfig *global)
{
- int res;
FILE *file;
char filebuffer[512];
bool usedarg = FALSE;
- char *home;
int rc = 0;
struct OperationConfig *operation = global->first;
@@ -58,8 +56,8 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
/* NULL or no file name attempts to load .curlrc from the homedir! */
#ifndef __AMIGA__
+ char *home = homedir(); /* portable homedir finder */
filename = CURLRC; /* sensible default */
- home = homedir(); /* portable homedir finder */
if(home) {
if(strlen(home) < (sizeof(filebuffer) - strlen(CURLRC))) {
snprintf(filebuffer, sizeof(filebuffer),
@@ -125,13 +123,13 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
char *option;
char *param;
int lineno = 0;
- bool alloced_param;
bool dashed_option;
while(NULL != (aline = my_get_line(file))) {
+ int res;
+ bool alloced_param = FALSE;
lineno++;
line = aline;
- alloced_param = FALSE;
/* line with # in the first non-blank column is a comment! */
while(*line && ISSPACE(*line))