mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-17 16:26:59 +00:00
all: fix compiler warninings
Use compiler warnings from coreutils to check nothing complains, and fix everything that did. CFLAGS='-Wall -W -Wformat-y2k -Wformat-security -Winit-self -Wmissing-include-dirs -Wunused -Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wmissing-declarations -Wmissing-noreturn -Wpacked -Winvalid-pch -Wvolatile-register-var -Wdisabled-optimization -Woverlength-strings -Wbuiltin-macro-redefined -Wmudflap -Wpacked-bitfield-compat -Wsync-nand -Wattributes -Wcoverage-mismatch -Wabi -Wcpp -Wdeprecated -Wdeprecated-declarations -Wdiv-by-zero -Wendif-labels -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar -Wnormalized=nfc -Woverflow -Wpointer-to-int-cast -Wpragmas -Wsuggest-attribute=noreturn -Wtrampolines -Wno-sign-compare -Wno-unused-parameter -Wsuggest-attribute=noreturn -Wno-format-nonliteral -Wno-logical-op -fdiagnostics-show-option -funit-at-a-time' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
37563d8d59
commit
b3e02ce0ba
6 changed files with 22 additions and 19 deletions
11
src/other.c
11
src/other.c
|
|
@ -104,7 +104,7 @@ int
|
|||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||
__attribute__ ((hot))
|
||||
#endif
|
||||
xstrstr(char *restrict a, char *restrict b, int len)
|
||||
xstrstr(char *restrict a, const char *restrict b, int len)
|
||||
{
|
||||
int i;
|
||||
/* two spaces are very common in lease file, after them
|
||||
|
|
@ -137,7 +137,7 @@ char *safe_strdup(const char *restrict str)
|
|||
}
|
||||
|
||||
/* Return percentage value */
|
||||
double strtod_or_err(const char *str, const char *errmesg)
|
||||
double strtod_or_err(const char *restrict str, const char *restrict errmesg)
|
||||
{
|
||||
double num;
|
||||
char *end = NULL;
|
||||
|
|
@ -158,16 +158,17 @@ double strtod_or_err(const char *str, const char *errmesg)
|
|||
errx(EXIT_FAILURE, "%s: '%s'", errmesg, str);
|
||||
}
|
||||
|
||||
void flip_ranges(struct range_t *restrict ranges, struct range_t *restrict tmp_ranges)
|
||||
void flip_ranges(struct range_t *restrict flip_me,
|
||||
struct range_t *restrict tmp_ranges)
|
||||
{
|
||||
unsigned int i = num_ranges - 1, j;
|
||||
|
||||
for (j = 0; j < num_ranges; j++) {
|
||||
*(tmp_ranges + j) = *(ranges + i);
|
||||
*(tmp_ranges + j) = *(flip_me + i);
|
||||
i--;
|
||||
}
|
||||
|
||||
memcpy(ranges, tmp_ranges, num_ranges * sizeof(struct range_t));
|
||||
memcpy(flip_me, tmp_ranges, num_ranges * sizeof(struct range_t));
|
||||
}
|
||||
|
||||
/* Free memory, flush buffers etc */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue