From c45360d4633850839bb9c2d77dbf8a8285e9ad49 Mon Sep 17 00:00:00 2001 From: Marian Klymov Date: Sat, 2 Jun 2018 23:52:56 +0300 Subject: 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 --- src/tool_parsecfg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/tool_parsecfg.c') 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)) -- cgit v1.2.3