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_insert()`](https://developer.gnome.org/glib/unstable/glib-Pointer-Arrays.html#g-ptr-arr...) is awfully recent (2.40), plus I really don't see the advantage over [`g_ptr_array_add()`](https://developer.gnome.org/glib/unstable/glib-Pointer-Arrays.html#g-ptr-arr...) which IIUC your usage would do exactly the same -- minus the theoretical possibility for inserting not at the end, which would kill the performances (and be wrong).