Merge branch 'g_slist_doc_update' into 'main'

gslist: Improve documentation for append / prepend / insert methods

See merge request GNOME/glib!4619
This commit is contained in:
Philip Withnall
2025-05-06 12:02:02 +00:00

View File

@@ -157,8 +157,8 @@ g_slist_free_full (GSList *list,
* *
* Adds a new element on to the end of the list. * Adds a new element on to the end of the list.
* *
* The return value is the new start of the list, which may * Note that the return value is the new start of the list
* have changed, so make sure you store the new value. * if @list was empty; make sure you store the new value.
* *
* Note that g_slist_append() has to traverse the entire list * Note that g_slist_append() has to traverse the entire list
* to find the end, which is inefficient when adding multiple * to find the end, which is inefficient when adding multiple
@@ -178,7 +178,7 @@ g_slist_free_full (GSList *list,
* number_list = g_slist_append (number_list, GINT_TO_POINTER (14)); * number_list = g_slist_append (number_list, GINT_TO_POINTER (14));
* ]| * ]|
* *
* Returns: the new start of the #GSList * Returns: either @list or the new start of the #GSList if @list was %NULL
*/ */
GSList* GSList*
g_slist_append (GSList *list, g_slist_append (GSList *list,
@@ -210,8 +210,8 @@ g_slist_append (GSList *list,
* *
* Adds a new element on to the start of the list. * Adds a new element on to the start of the list.
* *
* The return value is the new start of the list, which * Note that the return value is the new start of the list,
* may have changed, so make sure you store the new value. * which will have changed, so make sure you store the new value.
* *
* |[<!-- language="C" --> * |[<!-- language="C" -->
* // Notice that it is initialized to the empty list. * // Notice that it is initialized to the empty list.
@@ -220,7 +220,8 @@ g_slist_append (GSList *list,
* list = g_slist_prepend (list, "first"); * list = g_slist_prepend (list, "first");
* ]| * ]|
* *
* Returns: the new start of the #GSList * Returns: a pointer to the newly prepended element,
* which is the new start of the #GSList
*/ */
GSList* GSList*
g_slist_prepend (GSList *list, g_slist_prepend (GSList *list,
@@ -246,7 +247,7 @@ g_slist_prepend (GSList *list,
* *
* Inserts a new element into the list at the given position. * Inserts a new element into the list at the given position.
* *
* Returns: the new start of the #GSList * Returns: the (possibly changed) start of the #GSList
*/ */
GSList* GSList*
g_slist_insert (GSList *list, g_slist_insert (GSList *list,