mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +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;
|
||||
GDataElt *data, *data_end;
|
||||
|
||||
g_return_val_if_fail (datalist != NULL, NULL);
|
||||
|
||||
g_datalist_lock (datalist);
|
||||
|
||||
d = G_DATALIST_GET_POINTER (datalist);
|
||||
if (d)
|
||||
{
|
||||
data = d->data;
|
||||
data_end = data + d->len - 1;
|
||||
while (data <= data_end)
|
||||
data_end = data + d->len;
|
||||
do
|
||||
{
|
||||
if (data->key == key_id)
|
||||
{
|
||||
@ -867,6 +865,7 @@ g_datalist_id_dup_data (GData **datalist,
|
||||
}
|
||||
data++;
|
||||
}
|
||||
while (data < data_end);
|
||||
}
|
||||
|
||||
if (dup_func)
|
||||
|
Loading…
Reference in New Issue
Block a user