mie: update bluelib api usage

This commit is contained in:
2025-11-06 10:38:50 +00:00
parent 06f384e089
commit 6d172e1dc0
19 changed files with 226 additions and 173 deletions

View File

@@ -1,6 +1,6 @@
#include <blue/object/hashmap.h>
#include <blue/object/list.h>
#include <blue/object/string.h>
#include <blue/ds/hashmap.h>
#include <blue/ds/list.h>
#include <blue/ds/string.h>
#include <mie/ctx.h>
#include <mie/ir/const.h>
#include <stdlib.h>
@@ -62,23 +62,25 @@ void mie_ctx_destroy(struct mie_ctx *ctx)
ctx->ctx_true = NULL;
ctx->ctx_false = NULL;
b_btree_iterator it = {};
b_btree_iterator_begin(&ctx->ctx_int_cache, &it);
while (b_btree_iterator_is_valid(&it)) {
b_btree_node *node = b_btree_first(&ctx->ctx_int_cache);
while (node) {
struct ctx_int_cache_entry *entry
= b_unbox(struct ctx_int_cache_entry, it.node, i_node);
b_btree_iterator_erase(&it);
= b_unbox(struct ctx_int_cache_entry, node, i_node);
b_btree_node *next = b_btree_next(node);
b_btree_delete(&ctx->ctx_int_cache, node);
b_btree_iterator it2 = {};
b_btree_iterator_begin(&entry->i_values, &it2);
while (b_btree_iterator_is_valid(&it2)) {
b_btree_node *node2 = b_btree_first(&entry->i_values);
while (node2) {
struct ctx_int_value_cache_entry *value = b_unbox(
struct ctx_int_value_cache_entry, it2.node, i_node);
b_btree_iterator_erase(&it2);
struct ctx_int_value_cache_entry, node2, i_node);
b_btree_node *next2 = b_btree_next(node2);
b_btree_delete(&entry->i_values, node2);
free(value);
node2 = next2;
}
free(entry);
node = next;
}
const size_t nr_types = sizeof ctx->ctx_types / sizeof ctx->ctx_types[0];
@@ -93,7 +95,7 @@ void mie_ctx_destroy(struct mie_ctx *ctx)
mie_value_destroy(ctx->ctx_null);
}
b_hashmap_release(ctx->ctx_sel_cache);
b_hashmap_unref(ctx->ctx_sel_cache);
free(ctx);
}