forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
0957ba5220
commit
c86f0b1b23
@ -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++)
|
||||
|
Loading…
Reference in New Issue
Block a user