Skip to content

Commit ee508f0

Browse files
authored
Merge pull request #155 from Nordix/fix-warnings
Fix compiler warnings
2 parents c1aab00 + 7c625f8 commit ee508f0

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/slug.c

Lines changed: 0 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 5 additions & 5 deletions
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);
@@ -714,19 +714,19 @@ START_TEST(test_route_cmp)
714714
R3Route *r1 = r3_node_append_route(n,test_str, strlen(test_str),0,0);
715715
match_entry * m = match_entry_create("/blog/post");
716716

717-
fail_if( r3_route_cmp(r1, m) == -1, "should match");
717+
ck_assert_msg(r3_route_cmp(r1, m) == 0, "should match");
718718

719719
r1->request_method = METHOD_GET;
720720
m->request_method = METHOD_GET;
721-
fail_if( r3_route_cmp(r1, m) == -1, "should match");
721+
ck_assert_msg(r3_route_cmp(r1, m) == 0, "should match");
722722

723723
r1->request_method = METHOD_GET;
724724
m->request_method = METHOD_POST;
725-
fail_if( r3_route_cmp(r1, m) == 0, "should be different");
725+
ck_assert_msg(r3_route_cmp(r1, m) == -1, "should be different");
726726

727727
r1->request_method = METHOD_GET;
728728
m->request_method = METHOD_POST | METHOD_GET;
729-
fail_if( r3_route_cmp(r1, m) == -1, "should match");
729+
ck_assert_msg(r3_route_cmp(r1, m) == 0, "should match");
730730

731731
match_entry_free(m);
732732
r3_tree_free(n);

0 commit comments

Comments
 (0)