X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/ac9c5346f3f10ac7adf3772521fa4d18f17c97c7..270869139db617e29a35bb9ded41087bb702f9ac:/lunaix-os/includes/lunaix/ds/hstr.h diff --git a/lunaix-os/includes/lunaix/ds/hstr.h b/lunaix-os/includes/lunaix/ds/hstr.h index f3fa89e..f43a6db 100644 --- a/lunaix-os/includes/lunaix/ds/hstr.h +++ b/lunaix-os/includes/lunaix/ds/hstr.h @@ -1,15 +1,15 @@ #ifndef __LUNAIX_HSTR_H #define __LUNAIX_HSTR_H -#include +#include #define HSTR_FULL_HASH 32 struct hstr { - unsigned int hash; - unsigned int len; - char* value; + u32_t hash; + u32_t len; + const char* value; }; #define HSTR(str, length) \ @@ -26,10 +26,17 @@ struct hstr #define HSTR_EQ(str1, str2) ((str1)->hash == (str2)->hash) +#define HSTR_VAL(hstr) ((hstr).value) +#define HSTR_LEN(hstr) ((hstr).len) +#define HSTR_HASH(hstr) ((hstr).hash) + inline void -hstr_rehash(struct hstr* hash_str, unsigned int truncate_to) +hstr_rehash(struct hstr* hash_str, u32_t truncate_to) { hash_str->hash = strhash_32(hash_str->value, truncate_to); } +void +hstrcpy(struct hstr* dest, struct hstr* src); + #endif /* __LUNAIX_HSTR_H */