fix couple compiler warnings

src/getdata.c:248:22: warning: 'range_p' may be used uninitialized in this
function [-Wmaybe-uninitialized]
src/other.c:383:1: warning: control reaches end of non-void function
[-Wreturn-type]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2015-10-26 22:43:31 +00:00
parent 535dfc4fc2
commit c30c122027
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
2 changed files with 5 additions and 1 deletions

View file

@ -178,7 +178,7 @@ void parse_config(int is_include, const char *restrict config_file,
char *word;
int braces_shared = 1000;
union ipaddr_t addr;
struct range_t *range_p;
struct range_t *range_p = NULL;
word = xmalloc(sizeof(char) * MAXLEN);
if (is_include)
@ -245,6 +245,9 @@ void parse_config(int is_include, const char *restrict config_file,
c = ' ';
break;
} else if (argument == ITS_A_RANGE_SECOND_IP && i == 0) {
if (!range_p) {
error(EXIT_FAILURE, 0, "parse_config: range_p uninitialized: please report a bug");
}
range_p->last_ip = range_p->first_ip;
goto newrange;
}

View file

@ -380,6 +380,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg)
return num;
err:
error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
return 0;
}
/*! \brief Reverse range.