comment for the function

This commit is contained in:
c9s 2014-06-02 08:19:44 +08:00
parent b4ce60de59
commit 9f58a5b651

View file

@ -82,6 +82,11 @@ void r3_tree_free(node * tree) {
tree = NULL; tree = NULL;
} }
/**
* Connect two node objects, and create an edge object between them.
*/
edge * r3_node_connectl(node * n, const 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;
@ -118,10 +123,13 @@ void r3_node_append_edge(node *n, edge *e) {
/** /**
* Find the existing edge with specified pattern (include slug) * Find the existing edge with specified pattern (include slug)
*
* if "pat" is a slug, we should compare with the specified pattern.
*/ */
edge * r3_node_find_edge(const node * n, const char * pat, int pat_len) { edge * r3_node_find_edge(const node * n, const char * pat, int pat_len) {
edge * e; edge * e;
for (int i = 0 ; i < n->edge_len ; i++ ) { int i;
for (i = 0 ; i < n->edge_len ; i++ ) {
e = n->edges[i]; e = n->edges[i];
// there is a case: "{foo}" vs "{foo:xxx}", // there is a case: "{foo}" vs "{foo:xxx}",