shithub: rgbds

Download patch

ref: 781a65ee498cf810d74168d43934407d60edd666
parent: c135e2c6a0ec8db1fe0380d9c4cb84a5ef74eea1
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun May 3 15:13:12 EDT 2020

Fix hashmap collisions sometimes hanging deletion

--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -78,6 +78,7 @@
 			*ptr = next;
 			return true;
 		}
+		ptr = &(*ptr)->next;
 	}
 	return false;
 }
--- /dev/null
+++ b/test/asm/sym-collision.asm
@@ -1,0 +1,34 @@
+; Hashmap collisions are pretty poorly-tested code path...
+; At some point, `PURGE` would malfunction with them
+
+SECTION "Collision course", OAM[$FE00]
+
+; All the following symbols collide!
+aqfj: ds 1 ; Give them different addresses
+cxje: ds 1
+dgsd: ds 1
+dork: ds 1
+lxok: ds 1
+psgp: ds 1
+sfly: ds 1
+syyq: ds 1
+ussg: ds 1
+xlmm: ds 1
+xtzp: ds 1
+zxfr: ds 1
+
+	; Completely by accident, but cool
+	PURGE dork
+
+	PRINTT "aqfj: {aqfj}\n"
+	PRINTT "cxje: {cxje}\n"
+	PRINTT "dgsd: {dgsd}\n"
+	PRINTT "dork: {dork}\n"
+	PRINTT "lxok: {lxok}\n"
+	PRINTT "psgp: {psgp}\n"
+	PRINTT "sfly: {sfly}\n"
+	PRINTT "syyq: {syyq}\n"
+	PRINTT "ussg: {ussg}\n"
+	PRINTT "xlmm: {xlmm}\n"
+	PRINTT "xtzp: {xtzp}\n"
+	PRINTT "zxfr: {zxfr}\n"
--- /dev/null
+++ b/test/asm/sym-collision.err
@@ -1,0 +1,3 @@
+ERROR: sym-collision.asm(26):
+    'dork' not defined
+error: Assembly aborted (1 errors)!
--- /dev/null
+++ b/test/asm/sym-collision.out
@@ -1,0 +1,12 @@
+aqfj: $FE00
+cxje: $FE01
+dgsd: $FE02
+dork: $0
+lxok: $FE04
+psgp: $FE05
+sfly: $FE06
+syyq: $FE07
+ussg: $FE08
+xlmm: $FE09
+xtzp: $FE0A
+zxfr: $FE0B