1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00
RetroArch/libretro-db/bintree.h

46 lines
784 B
C
Raw Normal View History

2015-01-19 21:47:09 +00:00
#ifndef __RARCHDB_BINTREE_H__
#define __RARCHDB_BINTREE_H__
typedef int (* bintree_cmp_func)(
const void * a,
const void * b,
void * ctx
);
typedef int (* bintree_iter_cb)(
void * value,
void * ctx
);
struct bintree_node {
void * value;
struct bintree_node * parent;
struct bintree_node * left;
struct bintree_node * right;
};
struct bintree {
struct bintree_node * root;
bintree_cmp_func cmp;
void * ctx;
};
void bintree_new(
struct bintree * t,
bintree_cmp_func cmp,
void * ctx
);
int bintree_insert(
struct bintree * t,
void * value
);
int bintree_iterate(
const struct bintree * t,
bintree_iter_cb cb,
void * ctx
);
void bintree_free(struct bintree * t);
#endif