Add a note of caution to the g_slist_delete_link() docs

This commit is contained in:
Matthias Clasen 2012-06-23 17:30:10 -04:00
parent 905184b3ef
commit 22e9f72a8e

View File

@ -515,6 +515,12 @@ _g_slist_remove_link (GSList *list,
* link is set to %NULL, so that it becomes a * link is set to %NULL, so that it becomes a
* self-contained list with one element. * self-contained list with one element.
* *
* <note>Removing arbitrary nodes from a singly-linked list
* requires time that is proportional to the length of the list
* (ie. O(n)). If you find yourself using g_slist_remove_link()
* frequently, you should consider a different data structure, such
* as the doubly-linked #GList.</note>
*
* Returns: the new start of the #GSList, without the element * Returns: the new start of the #GSList, without the element
*/ */
GSList* GSList*
@ -533,6 +539,12 @@ g_slist_remove_link (GSList *list,
* Compare this to g_slist_remove_link() which removes the node * Compare this to g_slist_remove_link() which removes the node
* without freeing it. * without freeing it.
* *
* <note>Removing arbitrary nodes from a singly-linked list
* requires time that is proportional to the length of the list
* (ie. O(n)). If you find yourself using g_slist_delete_link()
* frequently, you should consider a different data structure, such
* as the doubly-linked #GList.</note>
*
* Returns: the new head of @list * Returns: the new head of @list
*/ */
GSList* GSList*