From 108ff23f100023bc65dd074aea518fd164b27ae0 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Thu, 17 Oct 2024 00:47:46 +0800 Subject: [PATCH] fixup! cstr: fix type mismatch --- docs/cstr_api.md | 2 +- include/stc/priv/cstr_prv.c | 2 +- include/stc/priv/cstr_prv.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/cstr_api.md b/docs/cstr_api.md index faff95dc..312b727b 100644 --- a/docs/cstr_api.md +++ b/docs/cstr_api.md @@ -138,7 +138,7 @@ Note that all methods with arguments `(..., const char* str, isize n)`, `n` must #### Helper methods: ```c -uint64_t cstr_hash(const cstr* self); +size_t cstr_hash(const cstr* self); int cstr_cmp(const cstr* s1, const cstr* s2); bool cstr_eq(const cstr* s1, const cstr* s2); int cstr_icmp(const cstr* s1, const cstr* s2); // utf8 case-insensitive comparison diff --git a/include/stc/priv/cstr_prv.c b/include/stc/priv/cstr_prv.c index 5b23a4d7..af86b414 100644 --- a/include/stc/priv/cstr_prv.c +++ b/include/stc/priv/cstr_prv.c @@ -23,7 +23,7 @@ #ifndef STC_CSTR_CORE_INCLUDED #define STC_CSTR_CORE_INCLUDED -uint64_t cstr_hash(const cstr *self) { +size_t cstr_hash(const cstr *self) { csview sv = cstr_sv(self); return c_hash_n(sv.buf, sv.size); } diff --git a/include/stc/priv/cstr_prv.h b/include/stc/priv/cstr_prv.h index 9b1466a2..4fbfcdfb 100644 --- a/include/stc/priv/cstr_prv.h +++ b/include/stc/priv/cstr_prv.h @@ -26,6 +26,7 @@ #include /* FILE*, vsnprintf */ #include /* malloc */ +#include /* size_t */ /**************************** PRIVATE API **********************************/ #if defined __GNUC__ && !defined __clang__ @@ -76,7 +77,7 @@ extern bool cstr_getdelim(cstr *self, int delim, FILE *fp); extern void cstr_erase(cstr* self, isize pos, isize len); extern isize cstr_append_fmt(cstr* self, const char* fmt, ...); extern isize cstr_printf(cstr* self, const char* fmt, ...); -extern uint64_t cstr_hash(const cstr *self); +extern size_t cstr_hash(const cstr *self); extern bool cstr_u8_valid(const cstr* self); extern void cstr_u8_erase(cstr* self, isize u8pos, isize u8len);