Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings #155

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/slug.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
return 0;
}

int cnt = 0;
int state = 0;
const char * p = offset;

Expand Down Expand Up @@ -122,7 +121,6 @@ int r3_slug_parse(r3_slug_t *s, const char *needle, int needle_len, const char *
if (s->pattern) {
s->pattern_len = p - s->pattern;
}
cnt++;
state--;
p++;
break;
Expand Down
6 changes: 3 additions & 3 deletions tests/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@



unsigned long unixtime() {
unsigned long unixtime(void) {
struct timeval tp;
if (gettimeofday((struct timeval *) &tp, (NULL)) == 0) {
return tp.tv_sec;
}
return 0;
}

double microtime() {
double microtime(void) {
struct timeval tp;
long sec = 0L;
double msec = 0.0;
Expand Down Expand Up @@ -93,7 +93,7 @@ void bench_append_csv(char *filename, int countOfB, ...) {



int main()
int main(void)
{
R3Node * n = r3_tree_create(1);

Expand Down
4 changes: 2 additions & 2 deletions tests/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ typedef struct {
double end;
} bench;

unsigned long unixtime();
unsigned long unixtime(void);

double microtime();
double microtime(void);

void bench_start(bench *b);

Expand Down
10 changes: 5 additions & 5 deletions tests/check_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ START_TEST (test_node_construct_and_free)
}
END_TEST

static R3Node * create_simple_str_tree() {
static R3Node * create_simple_str_tree(void) {
R3Node * n;
n = r3_tree_create(10);
r3_tree_insert_path(n, "/zoo", NULL);
Expand Down Expand Up @@ -714,19 +714,19 @@ START_TEST(test_route_cmp)
R3Route *r1 = r3_node_append_route(n,test_str, strlen(test_str),0,0);
match_entry * m = match_entry_create("/blog/post");

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

r1->request_method = METHOD_GET;
m->request_method = METHOD_GET;
fail_if( r3_route_cmp(r1, m) == -1, "should match");
ck_assert_msg(r3_route_cmp(r1, m) == 0, "should match");

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

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

match_entry_free(m);
r3_tree_free(n);
Expand Down
Loading