shithub: sl

Download patch

ref: 327ed4da378d55750598882e3273ae6e73a0a6bd
parent: 6897271228d9851147273896b1ed901f94a34750
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Feb 10 14:29:42 EST 2025

setc: avoid double eval

--- a/src/flisp.h
+++ b/src/flisp.h
@@ -142,9 +142,10 @@
 #define set(s, v) (((symbol_t*)ptr(s))->binding = (v))
 #define setc(s, v) \
 	do{ \
-		((symbol_t*)ptr(s))->flags |= FLAG_CONST; \
-		((symbol_t*)ptr(s))->binding = (v); \
-	}while (0)
+		symbol_t *sy = (symbol_t*)ptr(s); \
+		sy->flags |= FLAG_CONST; \
+		sy->binding = (v); \
+	}while(0)
 #define isconstant(s) ((s)->flags & FLAG_CONST)
 #define iskeyword(s) ((s)->flags & FLAG_KEYWORD)
 #define symbol_value(s) (((symbol_t*)ptr(s))->binding)