39 lines
665 B
C
39 lines
665 B
C
#ifndef LSM_BT_INTERNAL
|
|
#define LSM_BT_INTERNAL
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "lsm.h"
|
|
#include "lsm/bt.h"
|
|
|
|
/**
|
|
* Node inside a binary tree
|
|
*/
|
|
typedef struct lsm_bt_node {
|
|
struct lsm_bt_node *left;
|
|
struct lsm_bt_node *right;
|
|
void *data;
|
|
char key;
|
|
} lsm_bt_node;
|
|
|
|
/**
|
|
* Initialize a new binary tree node
|
|
*
|
|
* @param ptr where to store newly allocated pointer
|
|
* @param key key for the node
|
|
* @param data data to store
|
|
*/
|
|
lsm_error lsm_bt_node_init(lsm_bt_node **ptr, const char key, void *data);
|
|
|
|
/**
|
|
* Deallocate a single binary tree node
|
|
*/
|
|
void lsm_bt_node_free(lsm_bt_node *node);
|
|
|
|
struct lsm_bt {
|
|
lsm_bt_node *root;
|
|
uint8_t size;
|
|
};
|
|
|
|
#endif
|