unfinished work

This commit is contained in:
liuwentan
2023-01-30 21:59:35 +08:00
parent 3d4b833e48
commit 25f944a1d1
49 changed files with 6537 additions and 6149 deletions

View File

@@ -130,4 +130,17 @@ int maat_kv_read_unNull(struct maat_kv_store* store, const char* key, size_t key
int maat_kv_read(struct maat_kv_store * store, const char * key, int * value)
{
return maat_kv_read_unNull(store, key, strlen(key), value);
}
struct maat_kv_store *maat_kv_store_duplicate(struct maat_kv_store *origin_map)
{
struct maat_kv_store *target = maat_kv_store_new();
struct maat_kv_pair *kv = NULL, *tmp_kv = NULL, *copy_kv = NULL;
HASH_ITER (hh, origin_map->hash, kv, tmp_kv) {
copy_kv = maat_kv_pair_new(kv->key, kv->keylen, kv->val);
HASH_ADD_KEYPTR(hh, target->hash, copy_kv->key, copy_kv->keylen, copy_kv);
}
return target;
}