This commit is contained in:
ZZY
2025-04-01 00:13:21 +08:00
parent 2b4857001c
commit 74f43a1ab7
79 changed files with 2271 additions and 2861 deletions

View File

@@ -1,6 +1,7 @@
#ifndef __SMCC_HASHTABLE_H__
#define __SMCC_HASHTABLE_H__
#include <lib/core.h>
#include <lib/rt/rt_alloc.h>
#include "vector.h"
@@ -29,11 +30,14 @@ typedef struct hash_table {
} hash_table_t;
// WARN you need set hash_func and key_cmp before use
void hashtable_init(hash_table_t* ht) ;
void init_hashtable(hash_table_t* ht) ;
void* hashtable_set(hash_table_t* ht, const void* key, void* value);
void* hashtable_get(hash_table_t* ht, const void* key);
void* hashtable_get(hash_table_t* ht, const void* key);
void* hashtable_del(hash_table_t* ht, const void* key);
void hashtable_destory(hash_table_t* ht);
typedef int (*hash_table_iter_func)(const void* key, void* value, void* context);
void hashtable_foreach(hash_table_t* ht, hash_table_iter_func iter_func, void* context);
#endif // __SMCC_HASHTABLE_H__