mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gdatalist: remove restriction of number of keys in g_datalist_id_remove_multiple()
If too many keys are requested, they temporary buffer is allocated on the heap. There is no problem in principle, to remove more than 16 keys. Well, the problem is that GData tracks entries in a linear list, so performance will degrade when it grows too much. That is a problem, and users should be careful to not add unreasonably many keys. But it's not the task of g_datalist_id_remove_multiple() to decide what is reasonable. This limitation was present from the beginning, in commit0415bf9412
('Add g_datalist_id_remove_multiple'). It's no longer necessary since commiteada6be364
('gdataset: cleanup g_data_remove_internal()').
This commit is contained in:
parent
48a1d8c695
commit
759ebf3663
@ -736,13 +736,17 @@ g_datalist_id_set_data_full (GData **datalist,
|
||||
* g_datalist_id_remove_multiple:
|
||||
* @datalist: a datalist
|
||||
* @keys: (array length=n_keys): keys to remove
|
||||
* @n_keys: length of @keys, must be <= 16
|
||||
* @n_keys: length of @keys.
|
||||
*
|
||||
* Removes multiple keys from a datalist.
|
||||
*
|
||||
* This is more efficient than calling g_datalist_id_remove_data()
|
||||
* multiple times in a row.
|
||||
*
|
||||
* Before 2.80, @n_keys had to be not larger than 16. Now it can be larger, but
|
||||
* note that GData does a linear search, so an excessive number of keys will
|
||||
* perform badly.
|
||||
*
|
||||
* Since: 2.74
|
||||
*/
|
||||
void
|
||||
@ -750,8 +754,6 @@ g_datalist_id_remove_multiple (GData **datalist,
|
||||
GQuark *keys,
|
||||
gsize n_keys)
|
||||
{
|
||||
g_return_if_fail (n_keys <= 16);
|
||||
|
||||
g_data_remove_internal (datalist, keys, n_keys);
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,6 @@ test_datalist_id_remove_multiple_resize (void)
|
||||
break;
|
||||
case 3:
|
||||
/* Mode: remove a list of (random) quarks. */
|
||||
n = n % 16;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
j = (j + PRIME) % N;
|
||||
|
Loading…
Reference in New Issue
Block a user