Changed slug parsing
This commit is contained in:
parent
b7c0132fa9
commit
40e0e1c2a0
2 changed files with 2 additions and 5 deletions
|
@ -450,9 +450,7 @@ R3Route * r3_tree_match_route(const R3Node *tree, match_entry * entry) {
|
||||||
for (i = n->route_len; i--; ) {
|
for (i = n->route_len; i--; ) {
|
||||||
if ( r3_route_cmp(n->routes[i], entry) == 0 ) {
|
if ( r3_route_cmp(n->routes[i], entry) == 0 ) {
|
||||||
// Add slugs from found route to match_entry
|
// Add slugs from found route to match_entry
|
||||||
for (int j = 0; j < n->routes[i]->slugs_len; j++) {
|
entry->vars->slugs = n->routes[i]->slugs;
|
||||||
str_array_append_slug(entry->vars , n->routes[i]->slugs[j]);
|
|
||||||
}
|
|
||||||
return n->routes[i];
|
return n->routes[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ str_array * str_array_create(int cap) {
|
||||||
list->len = 0;
|
list->len = 0;
|
||||||
list->slugs_len = 0;
|
list->slugs_len = 0;
|
||||||
list->cap = cap;
|
list->cap = cap;
|
||||||
list->slugs = (char**) zmalloc( sizeof(char*) * cap);
|
list->slugs = NULL;
|
||||||
list->tokens = (char**) zmalloc( sizeof(char*) * cap);
|
list->tokens = (char**) zmalloc( sizeof(char*) * cap);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ void str_array_free(str_array *l) {
|
||||||
zfree(l->tokens[i]);
|
zfree(l->tokens[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zfree(l->slugs);
|
|
||||||
zfree(l->tokens);
|
zfree(l->tokens);
|
||||||
zfree(l);
|
zfree(l);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue