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 /examples | |
| 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 'examples')
| -rw-r--r-- | examples/box.c | 4 | ||||
| -rw-r--r-- | examples/city.c | 4 | ||||
| -rw-r--r-- | examples/person_arc.c | 4 | ||||
| -rw-r--r-- | examples/rawptr_elements.c | 2 | ||||
| -rw-r--r-- | examples/vikings.c | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/examples/box.c b/examples/box.c index 4a43b149..c50ced1e 100644 --- a/examples/box.c +++ b/examples/box.c @@ -7,8 +7,8 @@ Person Person_new(const char* name, const char* last) { return (Person){.name = cstr_from(name), .last = cstr_from(last)};
}
-uint64_t Person_hash(const Person* a, size_t n) {
- return cstr_hash(&a->name, 0) ^ cstr_hash(&a->last, 0);
+uint64_t Person_hash(const Person* a) {
+ return cstr_hash(&a->name) ^ cstr_hash(&a->last);
}
int Person_cmp(const Person* a, const Person* b) {
diff --git a/examples/city.c b/examples/city.c index 0e1cbe96..d1bee4b7 100644 --- a/examples/city.c +++ b/examples/city.c @@ -12,8 +12,8 @@ static inline int City_cmp(const City* a, const City* b) { return c ? c : cstr_cmp(&a->country, &b->country);
}
-static inline uint64_t City_hash(const City* a, size_t n) {
- return cstr_hash(&a->name, 0) ^ cstr_hash(&a->country, 0);
+static inline uint64_t City_hash(const City* a) {
+ return cstr_hash(&a->name) ^ cstr_hash(&a->country);
}
static inline City City_clone(City c) {
diff --git a/examples/person_arc.c b/examples/person_arc.c index 9d245340..3e3f662f 100644 --- a/examples/person_arc.c +++ b/examples/person_arc.c @@ -12,8 +12,8 @@ int Person_cmp(const Person* a, const Person* b) { return c ? c : cstr_cmp(&a->last, &b->last);
}
-uint64_t Person_hash(const Person* a, size_t n) {
- return cstr_hash(&a->name, 0) ^ cstr_hash(&a->last, 0);
+uint64_t Person_hash(const Person* a) {
+ return cstr_hash(&a->name) ^ cstr_hash(&a->last);
}
Person Person_clone(Person p) {
diff --git a/examples/rawptr_elements.c b/examples/rawptr_elements.c index 20231528..a1344ea7 100644 --- a/examples/rawptr_elements.c +++ b/examples/rawptr_elements.c @@ -8,7 +8,7 @@ struct { double x, y; } typedef Point; #define i_key Point*
#define i_keydrop(x) c_free(*(x))
#define i_keyfrom(x) c_new(Point, *(x))
-#define i_hash(x, n) c_default_hash(*(x), sizeof **(x))
+#define i_hash(x) c_default_hash(*(x))
#define i_cmp(x, y) memcmp(*(x), *(y), sizeof **(x)) // not good!
#define i_tag pnt
#include <stc/cset.h>
diff --git a/examples/vikings.c b/examples/vikings.c index ff2fe8ab..51ab92f8 100644 --- a/examples/vikings.c +++ b/examples/vikings.c @@ -18,7 +18,7 @@ typedef struct RViking { const char* country; } RViking; -uint64_t RViking_hash(const RViking* raw, size_t ignore) { +uint64_t RViking_hash(const RViking* raw) { uint64_t hash = c_strhash(raw->name) ^ (c_strhash(raw->country) >> 15); return hash; } |
