diff options
| author | Tyge Løvset <[email protected]> | 2022-04-25 20:03:04 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-25 20:03:04 +0200 |
| commit | 29b1fb689c71837616023b3adc78eda3d32026b2 (patch) | |
| tree | 63f0bd3532f1819fb31d32c9c1c203eade79ea0c /docs | |
| parent | 72b40c6f5bbfbf11eba112a42ca5536c4c8e7d8f (diff) | |
| download | STC-modified-29b1fb689c71837616023b3adc78eda3d32026b2.tar.gz STC-modified-29b1fb689c71837616023b3adc78eda3d32026b2.zip | |
Removed size argument to `i_hash` template parameter and `c_default_hash`. This was a "design error", and is not worth keeping for backward compability. Please update your code where you use i_hash template parameter (simply remove second argument).
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/carc_api.md | 2 | ||||
| -rw-r--r-- | docs/cbox_api.md | 2 | ||||
| -rw-r--r-- | docs/ccommon_api.md | 2 | ||||
| -rw-r--r-- | docs/cmap_api.md | 11 | ||||
| -rw-r--r-- | docs/cstr_api.md | 2 | ||||
| -rw-r--r-- | docs/csview_api.md | 2 |
6 files changed, 10 insertions, 11 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md index 3f5675f0..301c25b1 100644 --- a/docs/carc_api.md +++ b/docs/carc_api.md @@ -47,7 +47,7 @@ long carc_X_use_count(carc_X ptr); void carc_X_reset(carc_X* self); void carc_X_reset_from(carc_X* self, i_val val); // assign new carc with value. Takes ownership of val. -uint64_t carc_X_value_hash(const i_val* x, size_t n); // hash value +uint64_t carc_X_value_hash(const i_val* x); // hash value int carc_X_value_cmp(const i_val* x, const i_val* y); // compares pointer addresses if 'i_opt c_no_cmp' // is defined. Otherwise uses 'i_cmp' or default compare. bool carc_X_value_eq(const i_val* x, const i_val* y); // cbox_X_value_cmp == 0 diff --git a/docs/cbox_api.md b/docs/cbox_api.md index a4e88801..2e16815b 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -44,7 +44,7 @@ void cbox_X_drop(cbox_X* self); // destruct the c void cbox_X_reset(cbox_X* self); void cbox_X_reset_from(cbox_X* self, i_val val); // assign new cbox with value. Takes ownership of val. -uint64_t cbox_X_value_hash(const i_val* x, size_t n); // hash value +uint64_t cbox_X_value_hash(const i_val* x); // hash value int cbox_X_value_cmp(const i_val* x, const i_val* y); // compares pointer addresses if 'i_opt c_no_cmp' // is defined. Otherwise uses 'i_cmp' or default compare. bool cbox_X_value_eq(const i_val* x, const i_val* y); // cbox_X_value_cmp == 0 diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md index 64c1f5fe..41a88065 100644 --- a/docs/ccommon_api.md +++ b/docs/ccommon_api.md @@ -214,7 +214,7 @@ void c_default_drop(Type* val); // does nothing typedef const char* crawstr; int crawstr_cmp(const crawstr* x, const crawstr* y); bool crawstr_eq(const crawstr* x, const crawstr* y); -uint64_t crawstr_hash(const crawstr* x, size_t dummy); +uint64_t crawstr_hash(const crawstr* x); ``` ### c_malloc, c_calloc, c_realloc, c_free diff --git a/docs/cmap_api.md b/docs/cmap_api.md index d51df6b2..a730bee0 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -85,10 +85,9 @@ cmap_X_raw cmap_X_value_toraw(cmap_X_value* pval); ``` Helpers: ```c -uint64_t c_strhash(const char *str); // utility function - -// hash template parameter functions: -uint64_t c_default_hash(const void *data, size_t len); // key is any integral type +uint64_t c_default_hash(const X *obj); // macro, calls c_fasthash(obj, sizeof *obj) +uint64_t c_strhash(const char *str); // string hash funcion, uses strlen() +uint64_t c_fasthash(const void *data, size_t len); // base hash function // equalto template parameter functions: bool c_default_eq(const i_keyraw* a, const i_keyraw* b); // *a == *b @@ -278,7 +277,7 @@ static inline int Viking_cmp(const Viking* a, const Viking* b) { return c ? c : cstr_cmp(&a->country, &b->country); } -static inline uint32_t Viking_hash(const Viking* a, int ignored) { +static inline uint32_t Viking_hash(const Viking* a) { return c_strhash(cstr_str(&a->name)) ^ (c_strhash(cstr_str(&a->country)) >> 15); } @@ -355,7 +354,7 @@ typedef struct RViking { const char* country; } RViking; -static inline uint64_t RViking_hash(const RViking* raw, size_t ignore) { +static inline uint64_t RViking_hash(const RViking* raw) { uint64_t hash = c_strhash(raw->name) ^ (c_strhash(raw->country) >> 15); return hash; } diff --git a/docs/cstr_api.md b/docs/cstr_api.md index 5005c6f7..a7c45152 100644 --- a/docs/cstr_api.md +++ b/docs/cstr_api.md @@ -84,7 +84,7 @@ Note that all methods with arguments `(..., const char* str, size_t n)`, `n` mus ```c int cstr_cmp(const cstr *s1, const cstr *s2); bool cstr_eq(const cstr *s1, const cstr *s2); -bool cstr_hash(const cstr *s, ...); +bool cstr_hash(const cstr *s); char* c_strnstrn(const char* str, const char* needle, size_t slen, size_t nlen); int c_strncasecmp(const char* str1, const char* str2, size_t n); diff --git a/docs/csview_api.md b/docs/csview_api.md index 57aa0d55..b4319c85 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -98,7 +98,7 @@ bool cstr_ends_with_sv(cstr s, csview sub); ```c int csview_cmp(const csview* x, const csview* y); bool csview_eq(const csview* x, const csview* y); -uint64_t csview_hash(const csview* x, size_t dummy); +uint64_t csview_hash(const csview* x); ``` ## Types |
