irungentoo/toxcore — pull request #918 by nurupo (2014-06-21 00:12:12+00:00)
Title: Reduced number of realloc calls bs_list does

It's a common practice to allocate a bit more space in dynamic arrays so that new element insertion won't cause the realloc call, which is costly [[1]](http://en.wikipedia.org/wiki/Dynamic_array#Bounded-size_dynamic_arrays_and_capacity), [[2]](http://en.wikipedia.org/wiki/Dynamic_array#Geometric_expansion_and_amortized_cost).
The list now reserves `1.5 * n + 1` when its capacity is reached and deallocates reserved memory when list is more than half empty, so that mixed sequence of insertions and deletions won't cause many realloc calls. `bs_list_trim()` can be used to remove the overhead memory manually.