mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-15 23:36:59 +00:00
various: fix few warnings
-Wmissing-variable-declarations -Wunreachable-code-break and -Wshadow. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
8731c6a11f
commit
6f6369f517
4 changed files with 13 additions and 11 deletions
|
|
@ -86,7 +86,6 @@ void do_counting(struct conf_t *state)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Size of range size. */
|
/* Size of range size. */
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ static void prepare_memory(struct conf_t *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief The --skip option argument parser. */
|
/*! \brief The --skip option argument parser. */
|
||||||
static void skip_arg_parse(struct conf_t *state, char *optarg)
|
static void skip_arg_parse(struct conf_t *state, char *arg)
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
OPT_ARG_OK = 0,
|
OPT_ARG_OK = 0,
|
||||||
|
|
@ -109,8 +109,8 @@ static void skip_arg_parse(struct conf_t *state, char *optarg)
|
||||||
};
|
};
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
while (*optarg != '\0') {
|
while (*arg != '\0') {
|
||||||
switch (getsubopt(&optarg, tokens, &value)) {
|
switch (getsubopt(&arg, tokens, &value)) {
|
||||||
case OPT_ARG_OK:
|
case OPT_ARG_OK:
|
||||||
state->skip_ok = 1;
|
state->skip_ok = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
@ -220,9 +221,11 @@ void parse_config(struct conf_t *state, const int is_include, const char *restri
|
||||||
#endif /* HAVE_POSIX_FADVISE */
|
#endif /* HAVE_POSIX_FADVISE */
|
||||||
/* Very hairy stuff begins. */
|
/* Very hairy stuff begins. */
|
||||||
while (unlikely(!feof(dhcpd_config))) {
|
while (unlikely(!feof(dhcpd_config))) {
|
||||||
char c;
|
int c;
|
||||||
|
|
||||||
c = fgetc(dhcpd_config);
|
c = fgetc(dhcpd_config);
|
||||||
|
if (CHAR_MAX < c)
|
||||||
|
continue;
|
||||||
/* Certain characters are magical */
|
/* Certain characters are magical */
|
||||||
switch (c) {
|
switch (c) {
|
||||||
/* Handle comments if they are not quoted */
|
/* Handle comments if they are not quoted */
|
||||||
|
|
@ -317,7 +320,7 @@ void parse_config(struct conf_t *state, const int is_include, const char *restri
|
||||||
/* Save to word which clause this is. */
|
/* Save to word which clause this is. */
|
||||||
if ((newclause == 1 || argument != ITS_NOTHING_INTERESTING)
|
if ((newclause == 1 || argument != ITS_NOTHING_INTERESTING)
|
||||||
&& (!isspace(c) || 0 < quote)) {
|
&& (!isspace(c) || 0 < quote)) {
|
||||||
word[i] = c;
|
word[i] = (char) c;
|
||||||
i++;
|
i++;
|
||||||
/* Long word which is almost causing overflow. None
|
/* Long word which is almost causing overflow. None
|
||||||
* of words are this long which the program is
|
* of words are this long which the program is
|
||||||
|
|
|
||||||
10
src/other.c
10
src/other.c
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
#include "dhcpd-pools.h"
|
#include "dhcpd-pools.h"
|
||||||
|
|
||||||
char *(*cidr_last) (union ipaddr_t *restrict addr, const int mask);
|
static char *(*cidr_last) (union ipaddr_t *restrict addr, const int mask);
|
||||||
static char *cidr_last_v4(union ipaddr_t *restrict addr, const int mask);
|
static char *cidr_last_v4(union ipaddr_t *restrict addr, const int mask);
|
||||||
static char *cidr_last_v6(union ipaddr_t *restrict addr, const int mask);
|
static char *cidr_last_v6(union ipaddr_t *restrict addr, const int mask);
|
||||||
|
|
||||||
|
|
@ -480,13 +480,13 @@ int
|
||||||
* \param Color mode string.
|
* \param Color mode string.
|
||||||
* \return color mode enum.
|
* \return color mode enum.
|
||||||
*/
|
*/
|
||||||
int parse_color_mode(const char *restrict optarg)
|
int parse_color_mode(const char *restrict arg)
|
||||||
{
|
{
|
||||||
if (!strcmp(optarg, "always"))
|
if (!strcmp(arg, "always"))
|
||||||
return color_on;
|
return color_on;
|
||||||
if (!strcmp(optarg, "auto"))
|
if (!strcmp(arg, "auto"))
|
||||||
return color_auto;
|
return color_auto;
|
||||||
if (!strcmp(optarg, "never"))
|
if (!strcmp(arg, "never"))
|
||||||
return color_off;
|
return color_off;
|
||||||
return color_unknown;
|
return color_unknown;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue