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--; ) {
|
||||
if ( r3_route_cmp(n->routes[i], entry) == 0 ) {
|
||||
// Add slugs from found route to match_entry
|
||||
for (int j = 0; j < n->routes[i]->slugs_len; j++) {
|
||||
str_array_append_slug(entry->vars , n->routes[i]->slugs[j]);
|
||||
}
|
||||
entry->vars->slugs = n->routes[i]->slugs;
|
||||
return n->routes[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ str_array * str_array_create(int cap) {
|
|||
list->len = 0;
|
||||
list->slugs_len = 0;
|
||||
list->cap = cap;
|
||||
list->slugs = (char**) zmalloc( sizeof(char*) * cap);
|
||||
list->slugs = NULL;
|
||||
list->tokens = (char**) zmalloc( sizeof(char*) * cap);
|
||||
return list;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ void str_array_free(str_array *l) {
|
|||
zfree(l->tokens[i]);
|
||||
}
|
||||
}
|
||||
zfree(l->slugs);
|
||||
zfree(l->tokens);
|
||||
zfree(l);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue