From e4bacb736063df78fabd2e689b0de4b9d6d9cb7c Mon Sep 17 00:00:00 2001 From: Max Wash Date: Mon, 16 Mar 2026 15:11:29 +0000 Subject: [PATCH] ds: update references to fx_btree --- ds/dict.c | 4 ++-- ds/hashmap.c | 4 ++-- ds/include/fx/ds/dict.h | 2 +- ds/include/fx/ds/hashmap.h | 2 +- test/ds/trees.c | 32 ++++++++++++++++---------------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ds/dict.c b/ds/dict.c index 6355448..47b12c3 100644 --- a/ds/dict.c +++ b/ds/dict.c @@ -38,9 +38,9 @@ struct fx_dict_iterator_p { /*** MISC FUNCTIONS ***********************************************************/ -static FX_BTREE_DEFINE_SIMPLE_GET( +static FX_BST_DEFINE_SIMPLE_GET( struct fx_dict_bucket, uint64_t, bk_node, bk_hash, get_bucket); -static FX_BTREE_DEFINE_SIMPLE_INSERT( +static FX_BST_DEFINE_SIMPLE_INSERT( struct fx_dict_bucket, bk_node, bk_hash, put_bucket); uint64_t fx_cstr_hash(const char *s) diff --git a/ds/hashmap.c b/ds/hashmap.c index b5adf37..66cf184 100644 --- a/ds/hashmap.c +++ b/ds/hashmap.c @@ -41,9 +41,9 @@ struct fx_hashmap_iterator_p { /*** PRIVATE FUNCTIONS ********************************************************/ -static FX_BTREE_DEFINE_SIMPLE_GET( +static FX_BST_DEFINE_SIMPLE_GET( struct fx_hashmap_bucket, uint64_t, bk_node, bk_hash, get_bucket); -static FX_BTREE_DEFINE_SIMPLE_INSERT( +static FX_BST_DEFINE_SIMPLE_INSERT( struct fx_hashmap_bucket, bk_node, bk_hash, put_bucket); static uint64_t hash_data(const void *p, size_t size) diff --git a/ds/include/fx/ds/dict.h b/ds/include/fx/ds/dict.h index 1bf58f0..9e15c6f 100644 --- a/ds/include/fx/ds/dict.h +++ b/ds/include/fx/ds/dict.h @@ -1,7 +1,7 @@ #ifndef FX_DS_DICT_H_ #define FX_DS_DICT_H_ -#include +#include #include #include #include diff --git a/ds/include/fx/ds/hashmap.h b/ds/include/fx/ds/hashmap.h index cd778be..aa03be1 100644 --- a/ds/include/fx/ds/hashmap.h +++ b/ds/include/fx/ds/hashmap.h @@ -1,7 +1,7 @@ #ifndef FX_DS_HASHMAP_H_ #define FX_DS_HASHMAP_H_ -#include +#include #include #include #include diff --git a/test/ds/trees.c b/test/ds/trees.c index f0da4e2..5970ea2 100644 --- a/test/ds/trees.c +++ b/test/ds/trees.c @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -12,13 +12,13 @@ struct tree_item { fx_tree_node node; }; -struct btree_item { +struct bst_item { int value; fx_bst_node node; }; -FX_BTREE_DEFINE_SIMPLE_GET(struct btree_item, int, node, value, get_node) -FX_BTREE_DEFINE_SIMPLE_INSERT(struct btree_item, node, value, put_node) +FX_BST_DEFINE_SIMPLE_GET(struct bst_item, int, node, value, get_node) +FX_BST_DEFINE_SIMPLE_INSERT(struct bst_item, node, value, put_node) int main(void) { @@ -71,19 +71,19 @@ int main(void) printf("%u\n", item->value); } - fx_bst btree = {0}; - struct btree_item items3[NITEMS] = {0}; + fx_bst bst = {0}; + struct bst_item items3[NITEMS] = {0}; for (int i = 0; i < NITEMS; i++) { items3[i].value = i; - put_node(&btree, &items3[i]); + put_node(&bst, &items3[i]); } printf("\n\n"); fx_bst_iterator it3; - fx_bst_foreach (&it3, &btree) { - struct btree_item *item - = fx_unbox(struct btree_item, it3.node, node); + fx_bst_foreach (&it3, &bst) { + struct bst_item *item + = fx_unbox(struct bst_item, it3.node, node); for (size_t i = 0; i < it3.depth; i++) { fputs(" ", stdout); @@ -92,10 +92,10 @@ int main(void) printf("%d\n", item->value); } - fx_bst_iterator_begin(&btree, &it3); + fx_bst_iterator_begin(&bst, &it3); while (fx_bst_iterator_is_valid(&it3)) { - struct btree_item *item - = fx_unbox(struct btree_item, it3.node, node); + struct bst_item *item + = fx_unbox(struct bst_item, it3.node, node); if (item->value == 9) { fx_bst_iterator_erase(&it3); @@ -106,9 +106,9 @@ int main(void) printf("\n\n"); - fx_bst_foreach (&it3, &btree) { - struct btree_item *item - = fx_unbox(struct btree_item, it3.node, node); + fx_bst_foreach (&it3, &bst) { + struct bst_item *item + = fx_unbox(struct bst_item, it3.node, node); for (size_t i = 0; i < it3.depth; i++) { fputs(" ", stdout);