Skip to content

Commit 2c06b8d

Browse files
committedOct 26, 2023
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 ..
1 parent c105117 commit 2c06b8d

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed
 

‎src/slug.c

-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
9090
return 0;
9191
}
9292

93-
int cnt = 0;
9493
int state = 0;
9594
const char * p = offset;
9695

@@ -122,7 +121,6 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
122121
if (s->pattern) {
123122
s->pattern_len = p - s->pattern;
124123
}
125-
cnt++;
126124
state--;
127125
p++;
128126
break;

‎tests/bench.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818

1919

20-
unsigned long unixtime() {
20+
unsigned long unixtime(void) {
2121
struct timeval tp;
2222
if (gettimeofday((struct timeval *) &tp, (NULL)) == 0) {
2323
return tp.tv_sec;
2424
}
2525
return 0;
2626
}
2727

28-
double microtime() {
28+
double microtime(void) {
2929
struct timeval tp;
3030
long sec = 0L;
3131
double msec = 0.0;
@@ -93,7 +93,7 @@ void bench_append_csv(char *filename, int countOfB, ...) {
9393

9494

9595

96-
int main()
96+
int main(void)
9797
{
9898
R3Node * n = r3_tree_create(1);
9999

‎tests/bench.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ typedef struct {
2222
double end;
2323
} bench;
2424

25-
unsigned long unixtime();
25+
unsigned long unixtime(void);
2626

27-
double microtime();
27+
double microtime(void);
2828

2929
void bench_start(bench *b);
3030

‎tests/check_tree.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ START_TEST (test_node_construct_and_free)
304304
}
305305
END_TEST
306306

307-
static R3Node * create_simple_str_tree() {
307+
static R3Node * create_simple_str_tree(void) {
308308
R3Node * n;
309309
n = r3_tree_create(10);
310310
r3_tree_insert_path(n, "/zoo", NULL);

0 commit comments

Comments
 (0)
Please sign in to comment.