Joe Nelson [Fri, 26 Mar 2021 02:50:55 +0000 (21:50 -0500)]
Have v_remove operate on a single element
This way it can work like a generalized pop(), and the caller
can use/free the element as desired. Removing a range has no
clean way to return the elements to the caller, other than
packaging up the results into a new vector perhaps.
Later we could add a v_erase() that works on a range and frees
the elements, like the C++ vector::erase(). Or call it v_delete()
like Vectors in Ada.
Joe Nelson [Fri, 26 Mar 2021 01:52:30 +0000 (20:52 -0500)]
Deal with large allocations more consistently
This is kind of academic because it's unlikely that such huge amounts
of memory could ever actually be allocated. In fact, probably impossible
given sizeof(void*). However I want the numerical logic to be correct,
and we'll leave it to realloc() to determine failure.