commit 48938555677bc0dac741493a032eba316f99e115
parent f6edab32b290c79e655ead598ed8bb7ffe93f90b
Author: Nikola <nikola@radojevic.rs>
Date: Wed, 4 May 2022 22:18:41 +0200
Handling hash collisions by comparing both hashes and idents
Fixes: https://todo.sr.ht/~sircmpwn/hare/679
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha
@@ -29,7 +29,8 @@ fn sched_module(plan: *plan, ident: ast::ident, link: *[]*task) *task = {
let hash = ident_hash(ident);
let bucket = &plan.modmap[hash % len(plan.modmap)];
for (let i = 0z; i < len(bucket); i += 1) {
- if (bucket[i].hash == hash) {
+ if (bucket[i].hash == hash
+ && ast::ident_eq(bucket[i].ident, ident)) {
return bucket[i].task;
};
};