more const pointers

This commit is contained in:
c9s 2014-05-28 21:03:59 +08:00
parent a2bec00a9e
commit 9cb2f80e1f
2 changed files with 4 additions and 4 deletions

View file

@ -133,11 +133,11 @@ void r3_tree_free(node * tree);
void r3_edge_free(edge * edge); void r3_edge_free(edge * edge);
edge * r3_node_connectl(node * n, char * pat, int len, int strdup, node *child); edge * r3_node_connectl(node * n, const char * pat, int len, int strdup, node *child);
#define r3_node_connect(n, pat, child) r3_node_connectl(n, pat, strlen(pat), 0, child) #define r3_node_connect(n, pat, child) r3_node_connectl(n, pat, strlen(pat), 0, child)
edge * r3_node_find_edge(const node * n, char * pat); edge * r3_node_find_edge(const node * n, const char * pat);
void r3_node_append_edge(node *n, edge *child); void r3_node_append_edge(node *n, edge *child);

View file

@ -77,7 +77,7 @@ void r3_tree_free(node * tree) {
tree = NULL; tree = NULL;
} }
edge * r3_node_connectl(node * n, char * pat, int len, int dupl, node *child) { edge * r3_node_connectl(node * n, const char * pat, int len, int dupl, node *child) {
// find the same sub-pattern, if it does not exist, create one // find the same sub-pattern, if it does not exist, create one
edge * e; edge * e;
@ -109,7 +109,7 @@ void r3_node_append_edge(node *n, edge *e) {
n->edges[ n->edge_len++ ] = e; n->edges[ n->edge_len++ ] = e;
} }
edge * r3_node_find_edge(const node * n, char * pat) { edge * r3_node_find_edge(const node * n, const char * pat) {
edge * e; edge * e;
for (int i = 0 ; i < n->edge_len ; i++ ) { for (int i = 0 ; i < n->edge_len ; i++ ) {
e = n->edges[i]; e = n->edges[i];