meta: replace bluelib with fx
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
#include "var-map.h"
|
||||
|
||||
#include <blue/ds/hashmap.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/hashmap.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
enum ivy_status codegen_var_map_init(struct codegen_var_map *map)
|
||||
{
|
||||
memset(map, 0x0, sizeof *map);
|
||||
map->m_map = b_hashmap_create(free, free);
|
||||
map->m_map = fx_hashmap_create(free, free);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
enum ivy_status codegen_var_map_fini(struct codegen_var_map *map)
|
||||
{
|
||||
b_hashmap_unref(map->m_map);
|
||||
fx_hashmap_unref(map->m_map);
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
enum ivy_status codegen_var_map_get(
|
||||
struct codegen_var_map *map, const char *ident, struct codegen_var **out)
|
||||
{
|
||||
b_hashmap_key key = {
|
||||
fx_hashmap_key key = {
|
||||
.key_data = ident,
|
||||
.key_size = strlen(ident),
|
||||
};
|
||||
|
||||
const b_hashmap_value *value = b_hashmap_get(map->m_map, &key);
|
||||
const fx_hashmap_value *value = fx_hashmap_get(map->m_map, &key);
|
||||
|
||||
if (!value) {
|
||||
return IVY_ERR_NO_ENTRY;
|
||||
@@ -42,8 +42,8 @@ enum ivy_status codegen_var_map_put(
|
||||
struct codegen_var_map *map, const char *ident,
|
||||
const struct codegen_var *var)
|
||||
{
|
||||
b_hashmap_key key = {
|
||||
.key_data = b_strdup(ident),
|
||||
fx_hashmap_key key = {
|
||||
.key_data = fx_strdup(ident),
|
||||
.key_size = strlen(ident),
|
||||
};
|
||||
|
||||
@@ -51,7 +51,7 @@ enum ivy_status codegen_var_map_put(
|
||||
return IVY_ERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
b_hashmap_value value = {
|
||||
fx_hashmap_value value = {
|
||||
.value_data = malloc(sizeof *var),
|
||||
.value_size = sizeof *var,
|
||||
};
|
||||
@@ -63,8 +63,8 @@ enum ivy_status codegen_var_map_put(
|
||||
|
||||
memcpy(value.value_data, var, sizeof *var);
|
||||
|
||||
b_status status = b_hashmap_put(map->m_map, &key, &value);
|
||||
if (!B_OK(status)) {
|
||||
fx_status status = fx_hashmap_put(map->m_map, &key, &value);
|
||||
if (!FX_OK(status)) {
|
||||
free((void *)key.key_data);
|
||||
free(value.value_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user