chore: ran formatter; added TRIE description file
This commit is contained in:
parent
1e5442379f
commit
2d7cce138d
4 changed files with 38 additions and 19 deletions
|
|
@ -29,12 +29,12 @@ typedef struct tinode {
|
|||
typedef struct tnode {
|
||||
Entry *entry;
|
||||
|
||||
TrieInnerNode* tree;
|
||||
uint8_t tree_size;
|
||||
TrieInnerNode *tree;
|
||||
uint8_t tree_size;
|
||||
|
||||
// Skips are at most 8 characters, and are stored in the nodes
|
||||
char string[TRIE_MAX_SKIP_SIZE];
|
||||
uint8_t string_len: 4;
|
||||
uint8_t string_len : 4;
|
||||
|
||||
bool represents : 1;
|
||||
} TrieNode;
|
||||
|
|
@ -130,8 +130,7 @@ void tnode_free(TrieNode *node) {
|
|||
* node represents a leaf with a string, because the struct and therefore the
|
||||
* address is created if it doesn't exist yet.
|
||||
*/
|
||||
TrieNode **tnode_search(TrieNode *node, const char c,
|
||||
bool create) {
|
||||
TrieNode **tnode_search(TrieNode *node, const char c, bool create) {
|
||||
// It can happen that the node has no initialized root yet
|
||||
if (node->tree_size == 0) {
|
||||
if (create) {
|
||||
|
|
@ -197,7 +196,8 @@ TrieNode **tnode_search(TrieNode *node, const char c,
|
|||
/* TrieNode *new_node = tnode_init(); */
|
||||
/* char key = node->ptr.string[0]; */
|
||||
|
||||
/* // There's a chance the remaining string was only 1 character, meaning the new */
|
||||
/* // There's a chance the remaining string was only 1 character, meaning the
|
||||
* new */
|
||||
/* // node doesn't have to store a string */
|
||||
/* if (node->ptr.string[1] != DELIMITER) { */
|
||||
/* tnode_set_string(new_node, node->ptr.string + 1); */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue