shithub: libgraphics

Download patch

ref: 39681ad94171c38431a2f2c525f8dd3931aa57f0
parent: f0ab207b60950e7b7748e919f599b0e1406d0895
author: rodri <rgl@antares-labs.eu>
date: Sun Feb 22 06:13:00 EST 2026

itemarray: better itemarrayadd() allocation strategy

--- a/itemarray.c
+++ b/itemarray.c
@@ -26,7 +26,8 @@
 	usize idx;
 
 	idx = a->nitems;
-	a->items = _erealloc(a->items, ++a->nitems * a->itemsize);
+	if(a->nitems++ % 16 == 0)
+		a->items = _erealloc(a->items, (a->nitems + 15)*a->itemsize);
 	p = a->items;
 	p += idx*a->itemsize;
 	memmove(p, i, a->itemsize);
--