Fix a warning and use a better hash name

This commit is contained in:
Sami Samhuri 2022-02-21 19:35:59 -08:00
parent 001478f7e8
commit b24d30af75
No known key found for this signature in database
GPG key ID: 4B4195422742FC16
3 changed files with 14 additions and 14 deletions

View file

@ -12,21 +12,21 @@
#include "hash.h"
void lake_hash_put(khash_t(value) * h, char *key, void *val)
void lake_hash_put(khash_t(LakeVal) * h, char *key, void *val)
{
int ret;
khiter_t k = kh_put(value, h, key, &ret);
khiter_t k = kh_put(LakeVal, h, key, &ret);
kh_value(h, k) = val;
}
void *lake_hash_get(khash_t(value) * h, char *key)
void *lake_hash_get(khash_t(LakeVal) * h, char *key)
{
khiter_t k = kh_get(value, h, key);
khiter_t k = kh_get(LakeVal, h, key);
return k == kh_end(h) ? NULL : kh_value(h, k);
}
bool lake_hash_has(khash_t(value) * h, char *key)
bool lake_hash_has(khash_t(LakeVal) * h, char *key)
{
khiter_t k = kh_get(value, h, key);
khiter_t k = kh_get(LakeVal, h, key);
return kh_exist(h, k);
}

View file

@ -16,15 +16,15 @@
#include "common.h"
#include "khash.h"
KHASH_MAP_INIT_STR(value, void *);
KHASH_MAP_INIT_STR(LakeVal, void *);
typedef khash_t(value) lake_hash_t;
typedef khash_t(LakeVal) lake_hash_t;
#define lake_hash_make() kh_init(value)
#define lake_hash_free(h) kh_destroy(value, h)
#define lake_hash_make() kh_init(LakeVal)
#define lake_hash_free(h) kh_destroy(LakeVal, h)
bool lake_hash_has(khash_t(value) * h, char *key);
void lake_hash_put(khash_t(value) * h, char *key, void *val);
void *lake_hash_get(khash_t(value) * h, char *key);
bool lake_hash_has(khash_t(LakeVal) * h, char *key);
void lake_hash_put(khash_t(LakeVal) * h, char *key, void *val);
void *lake_hash_get(khash_t(LakeVal) * h, char *key);
#endif

View file

@ -56,7 +56,7 @@ static char *test_int_repr(void)
i = int_from_c(2147483647);
lt_assert("int_repr is wrong", strcmp(int_repr(i), "2147483647") == 0);
i = int_from_c(2147483648);
i = int_from_c((unsigned int)2147483648);
lt_assert("int_repr is wrong", strcmp(int_repr(i), "-2147483648") == 0);
return 0;