shithub: sl

Download patch

ref: 108a9de63855e85b23b98edcffa095ffed9eb9f8
parent: 6e6df4d86d4e7768097985a3b84bad3555ea370d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Feb 10 13:43:19 EST 2025

relocate: use forwardloc/isforwarded with cons

--- a/src/flisp.c
+++ b/src/flisp.c
@@ -373,15 +373,15 @@
 		// iterative implementation allows arbitrarily long cons chains
 		pcdr = &first;
 		do{
-			if((a = car_(v)) == TAG_FWD){
-				*pcdr = cdr_(v);
+			a = car_(v);
+			if(isforwarded(v)){
+				*pcdr = forwardloc(v);
 				return first;
 			}
-			car_(v) = TAG_FWD;
 			d = cdr_(v);
 			*pcdr = nc = tagptr((cons_t*)FL(curheap), TAG_CONS);
 			FL(curheap) += sizeof(cons_t);
-			cdr_(v) = nc;
+			forward(v, nc);
 			car_(nc) = ismanaged(a) ? relocate(a) : a;
 			pcdr = &cdr_(nc);
 			v = d;