Fix Clang compiler warnings

When building using a newer Clang with additional diagnostics
the following warnings are given:
 -Wunused-but-set-variable
 -Wstrict-prototypes
These issues are corrected in this commit.

Reproducable using:
CC="clang-13" CFLAGS="-Wall -pedantic" cmake ..
This commit is contained in:
Björn Svensson 2023-09-22 14:42:56 +02:00
parent c105117b40
commit 2c06b8d750
4 changed files with 6 additions and 8 deletions

View file

@ -90,7 +90,6 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
return 0; return 0;
} }
int cnt = 0;
int state = 0; int state = 0;
const char * p = offset; const char * p = offset;
@ -122,7 +121,6 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
if (s->pattern) { if (s->pattern) {
s->pattern_len = p - s->pattern; s->pattern_len = p - s->pattern;
} }
cnt++;
state--; state--;
p++; p++;
break; break;

View file

@ -17,7 +17,7 @@
unsigned long unixtime() { unsigned long unixtime(void) {
struct timeval tp; struct timeval tp;
if (gettimeofday((struct timeval *) &tp, (NULL)) == 0) { if (gettimeofday((struct timeval *) &tp, (NULL)) == 0) {
return tp.tv_sec; return tp.tv_sec;
@ -25,7 +25,7 @@ unsigned long unixtime() {
return 0; return 0;
} }
double microtime() { double microtime(void) {
struct timeval tp; struct timeval tp;
long sec = 0L; long sec = 0L;
double msec = 0.0; double msec = 0.0;
@ -93,7 +93,7 @@ void bench_append_csv(char *filename, int countOfB, ...) {
int main() int main(void)
{ {
R3Node * n = r3_tree_create(1); R3Node * n = r3_tree_create(1);

View file

@ -22,9 +22,9 @@ typedef struct {
double end; double end;
} bench; } bench;
unsigned long unixtime(); unsigned long unixtime(void);
double microtime(); double microtime(void);
void bench_start(bench *b); void bench_start(bench *b);

View file

@ -304,7 +304,7 @@ START_TEST (test_node_construct_and_free)
} }
END_TEST END_TEST
static R3Node * create_simple_str_tree() { static R3Node * create_simple_str_tree(void) {
R3Node * n; R3Node * n;
n = r3_tree_create(10); n = r3_tree_create(10);
r3_tree_insert_path(n, "/zoo", NULL); r3_tree_insert_path(n, "/zoo", NULL);