2024-11-06 stan
dict_t *dict_balance;
static dict_t *dict_asset;
struct asset_type {
int prec_save;
int prec_show;
};
asset_dict 相关函数:static uint32_t asset_dict_hash_function(const void *key)
{
return dict_generic_hash_function(key, strlen(key));
}
}
static void *asset_dict_key_dup(const void *key)
{
return strdup(key);
}
}
static void *asset_dict_val_dup(const void *val)
{
struct asset_type *obj = malloc(sizeof(struct asset_type));
if (obj == NULL)
return NULL;
memcpy(obj, val, sizeof(struct asset_type));
return obj;
}
}
static int asset_dict_key_compare(const void *key1, const void *key2)
{
return strcmp(key1, key2);
}
}
static void asset_dict_key_free(void *key)
{
free(key);
}
}
static void asset_dict_val_free(void *val)
{
free(val);
}
主要功能:
static uint32_t balance_dict_hash_function(const void *key)
{
return dict_generic_hash_function(key, sizeof(struct balance_key));
}