In src/tagmanager/tm_query.c:

> +
> +		if (match && q->type >= 0)
> +			match = tag->type & q->type;
> +
> +		/* Remove tag from the results. tags are unowned so removing is easy */
> +		if (!match)
> +			g_queue_unlink(&res, node);
> +	}
> +
> +	/* Convert GQueue to GPtrArray for sort, dedup and return */
> +	i = 0;
> +	ret = g_ptr_array_sized_new(g_queue_get_length(&res));
> +	foreach_list(node, res.head)
> +	{
> +		tag = (TMTag *) node->data;
> +		g_ptr_array_insert(ret, i++, tag);

g_ptr_array_add() would just traverse the whole array again and again so it's not the best tool for the job either.

What makes you think that? GPtrArray maintains a size, so no need for traversal -- which wouldn't even work with NULL items anyway). And g_ptr_array_add() is actually basically implemented as array->pdata[array->len++] = data;.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.