GNOME Bugzilla – Bug 78414
g_queue_remove() and g_queue_remove_all()
Last modified: 2011-02-18 16:09:28 UTC
Here is a patch to add these two functions to GQueue
Created attachment 7657 [details] adds g_queue_remove() and g_queue_remove_all()
What's the objective criterion for deciding what additional functions get added to GQueue? Why these two in particular?
I needed these two functions in particular, but I don't know the objective criterion for which functions get added. (And I don't care that much for these two functions).
Does the patch really handle the case where the node removed is the tail correctly?
No it doesn't. It needs to update the tail pointer.
Assuming that we don't add GRing and deprecate GQueue, I think it probably makes sense to complete GQueue to have a full GList/GSList equivalent API set.
Some discussion in http://mail.gnome.org/archives/gtk-devel-list/2003-September/msg00240.html
Created attachment 20415 [details] [review] patch
Created attachment 20503 [details] [review] New patch
i'm not particularly fond of adding the new API here. for one, i don't rule out addition of GRing in the future, since from my experience it offers a far supperior API to GQueue. for another, i'd like to see this new API get some discussion on gtk-devel-list prior to inclusion. on the technical side, the implementation has some issues, it should make better use of existing g_list API (e.g. to access the nth element) which had several validation passes for correctness already, and to make use of improvements/optimizations in that code (e.g. g_list_free() is O(1) for n elements, while queue_remove_all is not).
Tim, the GRing bug has been WONTFIXed. The gtk-devel-list discussion is linked above. Do you want it discussed once more ?
For reference, bug 59431 is the original GRing proposal, and http://mail.gnome.org/archives/gtk-devel-list/2002-November/msg00097. html is Owens rationale for WONTFIXing it.
thanks for the links matthias. yes, i intend to resurrect a GRing discussion in the future, basically because i don't agree with owen's rationale. i just haven't found the time to reply to that, and it looks like GRing stays somewhat low on my priority queue for still some time, since there're lots of other more pressing issues that require my attention.
I have committed this. See http://mail.gnome.org/archives/gtk-devel-list/2004-February/msg00129.html for an explanation.