shithub: sl

Download patch

ref: 26a557739a36368bc0fc570830a7cee782d8028f
parent: 7b792e1dede78174d255e93fdc64c94765ddd2d6
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Feb 4 17:27:47 EST 2025

types.c: less lines

--- a/src/types.c
+++ b/src/types.c
@@ -37,15 +37,13 @@
 		((symbol_t*)ptr(t))->type = ft;
 	}
 	ft->size = sz;
-	if(iscons(t)){
-		if(isarray){
-			fltype_t *eltype = get_type(car_(cdr_(t)));
-			assert(eltype != nil && eltype->size > 0);
-			ft->elsz = eltype->size;
-			ft->eltype = eltype;
-			ft->init = cvalue_array_init;
-			//eltype->artype = ft; -- this is a bad idea since some types carry array sizes
-		}
+	if(isarray && iscons(t)){
+		fltype_t *eltype = get_type(car_(cdr_(t)));
+		assert(eltype != nil && eltype->size > 0);
+		ft->elsz = eltype->size;
+		ft->eltype = eltype;
+		ft->init = cvalue_array_init;
+		//eltype->artype = ft; -- this is a bad idea since some types carry array sizes
 	}
 	*bp = ft;
 	return ft;
@@ -77,11 +75,9 @@
 relocate_typetable(void)
 {
 	htable_t *h = &FL(TypeTable);
-	size_t i;
-	void *nv;
-	for(i = 0; i < h->size; i += 2){
+	for(size_t i = 0; i < h->size; i += 2){
 		if(h->table[i] != HT_NOTFOUND){
-			nv = (void*)relocate((value_t)h->table[i]);
+			void *nv = (void*)relocate((value_t)h->table[i]);
 			h->table[i] = nv;
 			if(h->table[i+1] != HT_NOTFOUND)
 				((fltype_t*)h->table[i+1])->type = (value_t)nv;