diff --git a/include/r3.h b/include/r3.h index 1d8508d..3fdd02a 100644 --- a/include/r3.h +++ b/include/r3.h @@ -14,7 +14,30 @@ #include #include "r3_define.h" -#include "str_array.h" + +typedef struct _str_array { + char **tokens; + int len; + int cap; +} str_array; + +str_array * str_array_create(int cap); + +bool str_array_is_full(str_array * l); + +bool str_array_resize(str_array *l, int new_cap); + +bool str_array_append(str_array * list, char * token); + +void str_array_free(str_array *l); + +void str_array_dump(str_array *l); + +str_array * split_route_pattern(char *pattern, int pattern_len); + +#define str_array_fetch(t,i) t->tokens[i] +#define str_array_len(t) t->len +#define str_array_cap(t) t->cap #define node_edge_pattern(node,i) node->edges[i]->pattern @@ -192,4 +215,7 @@ enum { NODE_COMPARE_STR, NODE_COMPARE_PCRE, NODE_COMPARE_OPCODE }; enum { OP_EXPECT_MORE_DIGITS = 1, OP_EXPECT_MORE_WORDS, OP_EXPECT_NOSLASH, OP_EXPECT_NODASH, OP_EXPECT_MORE_ALPHA }; + + + #endif /* !R3_NODE_H */ diff --git a/include/str_array.h b/include/str_array.h deleted file mode 100644 index 3b37fda..0000000 --- a/include/str_array.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * str_array.h - * Copyright (C) 2014 c9s - * - * Distributed under terms of the MIT license. - */ - -#ifndef TOKEN_H -#define TOKEN_H - -#include "r3_define.h" - -typedef struct _str_array { - char **tokens; - int len; - int cap; -} str_array; - -str_array * str_array_create(int cap); - -bool str_array_is_full(str_array * l); - -bool str_array_resize(str_array *l, int new_cap); - -bool str_array_append(str_array * list, char * token); - -void str_array_free(str_array *l); - -void str_array_dump(str_array *l); - -str_array * split_route_pattern(char *pattern, int pattern_len); - -#define str_array_fetch(t,i) t->tokens[i] -#define str_array_len(t) t->len -#define str_array_cap(t) t->cap - -#endif /* !TOKEN_H */ diff --git a/src/edge.c b/src/edge.c index fe14b4c..a8b82f8 100644 --- a/src/edge.c +++ b/src/edge.c @@ -21,7 +21,6 @@ #include "r3.h" #include "r3_str.h" -#include "str_array.h" #include "zmalloc.h" edge * r3_edge_create(char * pattern, int pattern_len, node * child) { diff --git a/src/node.c b/src/node.c index 23dcddc..01c56c2 100644 --- a/src/node.c +++ b/src/node.c @@ -10,7 +10,6 @@ #include "r3.h" #include "r3_str.h" -#include "str_array.h" #include "zmalloc.h" // String value as the index http://judy.sourceforge.net/doc/JudySL_3x.htm diff --git a/src/str.c b/src/str.c index c794761..9c5e1e8 100644 --- a/src/str.c +++ b/src/str.c @@ -10,7 +10,6 @@ #include #include "r3.h" #include "r3_str.h" -#include "str_array.h" #include "zmalloc.h" int r3_pattern_to_opcode(char * pattern, int len) { diff --git a/src/token.c b/src/token.c index e0f23a8..aad57c3 100644 --- a/src/token.c +++ b/src/token.c @@ -8,7 +8,7 @@ #include #include #include -#include "str_array.h" +#include "r3.h" #include "r3_str.h" #include "zmalloc.h" diff --git a/tests/bench.c b/tests/bench.c index 00d7ad1..c42f15d 100644 --- a/tests/bench.c +++ b/tests/bench.c @@ -12,7 +12,6 @@ #include "r3.h" #include "r3_str.h" -#include "str_array.h" #include "zmalloc.h" #include "bench.h" diff --git a/tests/check_gvc.c b/tests/check_gvc.c index a286cc9..796c50d 100644 --- a/tests/check_gvc.c +++ b/tests/check_gvc.c @@ -11,7 +11,6 @@ #include "r3.h" #include "r3_str.h" #include "r3_gvc.h" -#include "str_array.h" #include "bench.h" START_TEST (test_gvc_render_dot) diff --git a/tests/check_slug.c b/tests/check_slug.c index c2e955c..1f1417d 100644 --- a/tests/check_slug.c +++ b/tests/check_slug.c @@ -10,7 +10,6 @@ #include #include "r3.h" #include "r3_str.h" -#include "str_array.h" #include "zmalloc.h" START_TEST (test_pattern_to_opcode) diff --git a/tests/check_tree.c b/tests/check_tree.c index 8f88139..93bfdf8 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -4,7 +4,6 @@ #include #include "r3.h" #include "r3_str.h" -#include "str_array.h" #include "zmalloc.h" #include "bench.h"