shithub: femtolisp

Download patch

ref: 3e42c9f3eef3380542edaa5eb9e5f33b37212d1f
parent: 6e1de7777b33d03b7baa34317fa9d2153cbf22d0
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Nov 27 18:22:01 EST 2024

*os-name*: make it a string

--- a/cvalues.c
+++ b/cvalues.c
@@ -103,6 +103,7 @@
 	cvalue_t *pcv;
 	int str = 0;
 
+	assert(type != nil);
 	if(valid_numtype(type->numtype) && type->numtype != T_MPINT)
 		return cprim(type, sz);
 
@@ -157,6 +158,8 @@
 	cvalue_t *pcv;
 	value_t cv;
 
+	assert(type != nil);
+	assert(ptr != nil);
 	pcv = alloc_words(CVALUE_NWORDS);
 	pcv->data = ptr;
 	pcv->len = sz;
--- a/flisp.c
+++ b/flisp.c
@@ -2209,14 +2209,14 @@
 	set(symbol("procedure?", false), builtin(OP_FUNCTIONP));
 	set(symbol("top-level-bound?", false), builtin(OP_BOUNDP));
 
-	set(symbol("*os-name*", false), symbol(__os_name__, false));
-
 	FL(the_empty_vector) = tagptr(alloc_words(1), TAG_VECTOR);
 	vector_setsize(FL(the_empty_vector), 0);
 
 	cvalues_init();
 
+	set(symbol("*os-name*", false), cvalue_static_cstring(__os_name__));
 	FL(memory_exception_value) = fl_list2(FL(MemoryError), cvalue_static_cstring("out of memory"));
+
 	const builtinspec_t *b;
 	for(i = 0, b = builtin_fns; i < nelem(builtin_fns); i++, b++)
 		set(symbol(b->name, false), cbuiltin(b->name, b->fptr));