jlist: autofill info structure to 0 before calling info function

This avoids having to specify all fields in the info function.
This commit is contained in:
Lephenixnoir 2024-09-04 08:50:38 +02:00
parent ba7b0a02d0
commit 12b29f8223
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -5,6 +5,7 @@
#include <gint/display.h>
#include <stdlib.h>
#include <string.h>
/* Type identifier for jlist */
static int jlist_type_id = -1;
@ -126,6 +127,7 @@ void jlist_update_model(jlist *l, int item_count)
l->item_count = item_count;
for(int i = 0; i < item_count; i++) {
memset(&l->items[i], 0, sizeof l->items[i]);
l->info_function(l, i, &l->items[i]);
}