You could maybe use my linked list module dlinklist.e. It's loosely modelled on C++ list container. Because slick c has dynamic typing you can push all different type of objects onto the list. Below the object is created first on the stack (or what appears to be a stack), then the entire object gets copied by value into the list (or maybe it's reference counted?) and the stack object dies. When the item is removed from the list the contained object lives on - I should probably set it to null so it gets garbage collected - hmm. Wow, look how much I don't know about slick C. You could also use an array - it has a dynamic length like c++ vector.
// ...
xretrace_item item;
item.buf_name = bufname;
item.line_marker_id = marker_id;
item.marker_id_valid = true;
item.mid_line = mid_line;
item.last_line = last_line;
item.col = col;
item.flags = flags;
item.window_id = window_id;
if (!dlist_push_front(alist, item))
{ ... }
// ...
boolean dlist_push_front(dlist & dl, typeless & val)
{
int nnode = dlist_get_new_node(dl, true);
if (nnode < 0) {
return false;
}
insert_at_front(dl, nnode);
dl.nodes[nnode].s_data = val;
return true;
}