mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-19 17:08:22 +01:00
Merge branch 'array-allocations' into 'master'
garray: Optimise over-allocations with g_array_insert_vals() See merge request GNOME/glib!53
This commit is contained in:
@@ -546,7 +546,10 @@ g_array_insert_vals (GArray *farray,
|
|||||||
/* Is the index off the end of the array, and hence do we need to over-allocate
|
/* Is the index off the end of the array, and hence do we need to over-allocate
|
||||||
* and clear some elements? */
|
* and clear some elements? */
|
||||||
if (index_ >= array->len)
|
if (index_ >= array->len)
|
||||||
|
{
|
||||||
|
g_array_maybe_expand (array, index_ - array->len + len);
|
||||||
return g_array_append_vals (g_array_set_size (farray, index_), data, len);
|
return g_array_append_vals (g_array_set_size (farray, index_), data, len);
|
||||||
|
}
|
||||||
|
|
||||||
g_array_maybe_expand (array, len);
|
g_array_maybe_expand (array, len);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user