shithub: femtolisp

Download patch

ref: 6a028566c703adb465acab5e662c3b73d5be32ca
parent: 3c4a68e023681288f7808ad585bd817730c8f113
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Nov 4 21:12:50 EST 2024

sixel: do not allocate anything in init besides sixel-output type

--- a/sixel.c
+++ b/sixel.c
@@ -56,6 +56,8 @@
 		lerrorf(ArgError, "invalid number of colors: %d", numcolors);
 	value_t v = cvalue(fsotype, sizeof(fso_t));
 	fso_t *f = value2c(fso_t*, v);
+	if(salloc == nil)
+		sixel_allocator_new(&salloc, malloc, calloc, realloc, free);
 	SIXELSTATUS r = sixel_output_new(&f->out, fso_write, f, salloc);
 	if(SIXEL_FAILED(r))
 		lerrorf(IOError, "could not create sixel output");
@@ -255,5 +257,4 @@
 {
 	fsosym = symbol("sixel-output");
 	fsotype = define_opaque_type(fsosym, sizeof(fso_t), &fso_vtable, nil);
-	sixel_allocator_new(&salloc, malloc, calloc, realloc, free);
 }