- /* add node to parent */
- struct trie_node *parent;
- struct trie_child *new_child;
- unsigned int new_child_idx;
-
- /* get new child link for list of childs of parent */
- new_child_idx = rules->trie_childs_cur;
- rules->trie_childs_cur++;
- new_child = &rules->trie_childs[new_child_idx];
- new_child->next_idx = 0;
- new_child->node_idx = new_node_idx;
- new_child->key = key;
-
- /* append child link to list of childs of parent */
- parent = &rules->trie_nodes[node_idx];
- if (parent->child_idx == 0) {
- parent->child_idx = new_child_idx;
- } else {
- struct trie_child *last_child;
-
- last_child = &rules->trie_childs[parent->last_child_idx];
- last_child->next_idx = new_child_idx;
- }
- parent->last_child_idx = new_child_idx;
+ struct trie_node *last_child;
+
+ last_child = &rules->trie_nodes[parent->last_child_idx];
+ last_child->next_child_idx = new_node_idx;