feat: pave way for pastebin integration
This commit is contained in:
parent
689a878978
commit
f1ec643f80
5 changed files with 112 additions and 61 deletions
|
|
@ -1,8 +1,10 @@
|
|||
#include "common.c"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ternarytrie.h"
|
||||
#include "common.c"
|
||||
|
||||
/**
|
||||
* Represents a node of the binary tree contained within each non-leaf
|
||||
* TernaryTrieNode.
|
||||
|
|
@ -30,7 +32,7 @@ typedef struct ttnode {
|
|||
TernaryTrieInnerNode *root;
|
||||
char *string;
|
||||
} ptr;
|
||||
char *payload;
|
||||
Entry *entry;
|
||||
// What type of node this is
|
||||
// 0: regular non-representing node
|
||||
// 1: regular representing node
|
||||
|
|
@ -101,9 +103,10 @@ void ttnode_free(TernaryTrieNode *node) {
|
|||
ttinode_free_cascade(node->ptr.root);
|
||||
}
|
||||
|
||||
if (node->payload != NULL) {
|
||||
free(node->payload);
|
||||
}
|
||||
// TODO properly free entry
|
||||
/* if (node->payload != NULL) { */
|
||||
/* free(node->payload); */
|
||||
/* } */
|
||||
|
||||
free(node);
|
||||
}
|
||||
|
|
@ -218,11 +221,11 @@ void ttnode_split(TernaryTrieNode *node) {
|
|||
new_node->type = 1;
|
||||
}
|
||||
|
||||
new_node->payload = node->payload;
|
||||
new_node->entry = node->entry;
|
||||
|
||||
node->type = 0;
|
||||
node->size = 0;
|
||||
node->payload = NULL;
|
||||
node->entry = NULL;
|
||||
|
||||
free(node->ptr.string);
|
||||
node->ptr.string = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue