Commit c86f0b1b authored by Matthias Clasen's avatar Matthias Clasen

bitmask: Optimize no-op resizes

Statistics for the gtk3-demo listbox example show that the
vast majority of calls to _gtk_allocated_bitmask_resize go
from a size of 2 to 2. Don't needlessly call realloc() in
this case.
parent 0957ba52
......@@ -52,6 +52,9 @@ gtk_allocated_bitmask_resize (GtkBitmask *mask,
gsize i;
if (size == mask->len)
return mask;
mask = g_realloc (mask, sizeof (GtkBitmask) + sizeof(VALUE_TYPE) * (size - 1));
for (i = mask->len; i < size; i++)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment