list.c small cleanup, add simplelist_setline()

add simplelist_setline() to allow literal strings or owner buffer
to be shown in the simplelist

this makes simplelist more versatile by allowing static strings
to be added directly instead of copying into the simplelist buffer
(ie not consuming the simplelist text buffer)

add bounds checking to simplelist_setline/addline
No one has more than SIMPLELIST_MAX_LINES..  right?
-- there are actually a few places this isn't checked..

use new setline function in debug menu

share the simplelist buffer with the list_draw fn for gui_synclist
since they shouldn't be in-use simultaneously we can save some stack

Change-Id: I4a1e64d3a621d326ff094241da55452c0ff746ba
This commit is contained in:
William Wilgus 2024-11-20 12:12:16 -05:00 committed by William Wilgus
parent 505bbcaff5
commit 35a913473e
5 changed files with 133 additions and 141 deletions

View file

@ -313,7 +313,7 @@ void simplelist_set_line_count(int lines);
int simplelist_get_line_count(void);
/* add a line in the list. */
void simplelist_addline(const char *fmt, ...) ATTRIBUTE_PRINTF(1,2);
void simplelist_setline(const char *text);
/* setup the info struct. members not setup in this function need to be assigned manually
members set in this function:
info.selection_size = 1;