mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-15 16:56:14 +01:00
Speed up g_dataset_id_dup_data
This code is used in the property notification path, so it better be fast. This commit removes a g_return_if_fail check and treats the common case of just a single data element better.
This commit is contained in:
parent
59df5440f3
commit
c90f283be3
@ -849,16 +849,14 @@ g_datalist_id_dup_data (GData **datalist,
|
|||||||
GData *d;
|
GData *d;
|
||||||
GDataElt *data, *data_end;
|
GDataElt *data, *data_end;
|
||||||
|
|
||||||
g_return_val_if_fail (datalist != NULL, NULL);
|
|
||||||
|
|
||||||
g_datalist_lock (datalist);
|
g_datalist_lock (datalist);
|
||||||
|
|
||||||
d = G_DATALIST_GET_POINTER (datalist);
|
d = G_DATALIST_GET_POINTER (datalist);
|
||||||
if (d)
|
if (d)
|
||||||
{
|
{
|
||||||
data = d->data;
|
data = d->data;
|
||||||
data_end = data + d->len - 1;
|
data_end = data + d->len;
|
||||||
while (data <= data_end)
|
do
|
||||||
{
|
{
|
||||||
if (data->key == key_id)
|
if (data->key == key_id)
|
||||||
{
|
{
|
||||||
@ -867,6 +865,7 @@ g_datalist_id_dup_data (GData **datalist,
|
|||||||
}
|
}
|
||||||
data++;
|
data++;
|
||||||
}
|
}
|
||||||
|
while (data < data_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dup_func)
|
if (dup_func)
|
||||||
|
Loading…
Reference in New Issue
Block a user