shithub: femtolisp

Download patch

ref: 944262d59abe6be8acd552d53e50bcc77ca89896
parent: 94ef25c7e31135f442e3ce7173772f58e78fbbc9
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Nov 10 22:44:48 EST 2024

const strings on *_error calls

--- a/flisp.c
+++ b/flisp.c
@@ -109,7 +109,7 @@
 }
 
 _Noreturn void
-lerrorf(value_t e, char *format, ...)
+lerrorf(value_t e, const char *format, ...)
 {
 	char msgbuf[256];
 	va_list args;
@@ -125,7 +125,7 @@
 }
 
 _Noreturn void
-type_error(char *expected, value_t got)
+type_error(const char *expected, value_t got)
 {
 	fl_raise(fl_listn(3, FL(TypeError), symbol(expected), got));
 }
--- a/flisp.h
+++ b/flisp.h
@@ -238,11 +238,11 @@
 	else \
 		for(l__ca=1; l__ca; l__ca=0, fl_restorestate(&_ctx))
 
-_Noreturn void lerrorf(value_t e, char *format, ...);
+_Noreturn void lerrorf(value_t e, const char *format, ...);
 void fl_savestate(fl_exception_context_t *_ctx);
 void fl_restorestate(fl_exception_context_t *_ctx);
 _Noreturn void fl_raise(value_t e);
-_Noreturn void type_error(char *expected, value_t got);
+_Noreturn void type_error(const char *expected, value_t got);
 _Noreturn void bounds_error(value_t arr, value_t ind);
 _Noreturn void unbound_error(value_t sym);