Simplify code that uses g_queue_insert_before() and insert_after()
[platform/upstream/glib.git] / glib / glist.c
index 1096f86..18e25da 100644 (file)
  * Each element in the list contains a piece of data, together with
  * pointers which link to the previous and next elements in the list.
  * Using these pointers it is possible to move through the list in both
- * directions (unlike the singly-linked <link
- * linkend="glib-Singly-Linked-Lists">#GSList</link> which
- * only allows movement through the list in the forward direction).
+ * directions (unlike the singly-linked [GSList][glib-Singly-Linked-Lists],
+ * which only allows movement through the list in the forward direction).
  *
  * The double linked list does not keep track of the number of items 
  * and does not keep track of both the start and end of the list. If
  * you want fast access to both the start and the end of the list, 
  * and/or the number of items in the list, use a
- * <link linkend="glib-Double-ended-Queues">GQueue</link> instead.
+ * [GQueue][glib-Double-ended-Queues] instead.
  *
  * The data contained in each element can be either integer values, by
- * using one of the <link linkend="glib-Type-Conversion-Macros">Type
- * Conversion Macros</link>, or simply pointers to any type of data.
+ * using one of the [Type Conversion Macros][glib-Type-Conversion-Macros],
+ * or simply pointers to any type of data.
  *
- * List elements are allocated from the <link
- * linkend="glib-Memory-Slices">slice allocator</link>, which is more
- * efficient than allocating elements individually.
+ * List elements are allocated from the [slice allocator][glib-Memory-Slices],
+ * which is more efficient than allocating elements individually.
  *
  * Note that most of the #GList functions expect to be passed a pointer
  * to the first element in the list. The functions which insert
  * g_list_insert() and g_list_insert_sorted().
  *
  * To visit all elements in the list, use a loop over the list:
- * |[
+ * |[<!-- language="C" -->
  * GList *l;
  * for (l = list; l != NULL; l = l->next)
  *   {
- *     /&ast; do something with l->data &ast;/
+ *     // do something with l->data
  *   }
  * ]|
  *
  *
  * To loop over the list and modify it (e.g. remove a certain element)
  * a while loop is more appropriate, for example:
- * |[
+ * |[<!-- language="C" -->
  * GList *l = list;
  * while (l != NULL)
  *   {
  *     GList *next = l->next;
  *     if (should_be_removed (l))
  *       {
- *         /&ast; possibly free l->data &ast;/
+ *         // possibly free l->data
  *         list = g_list_delete_link (list, l);
  *       }
  *     l = next;
 /**
  * GList:
  * @data: holds the element's data, which can be a pointer to any kind
- *        of data, or any integer value using the <link
- *        linkend="glib-Type-Conversion-Macros">Type Conversion
- *        Macros</link>.
+ *        of data, or any integer value using the 
+ *        [Type Conversion Macros][glib-Type-Conversion-Macros]
  * @next: contains the link to the next element in the list
  * @prev: contains the link to the previous element in the list
  *
@@ -236,15 +233,15 @@ g_list_free_full (GList          *list,
  * to avoid the inefficiency is to use g_list_prepend() and reverse
  * the list with g_list_reverse() when all elements have been added.
  *
- * |[
- * /&ast; Notice that these are initialized to the empty list. &ast;/
+ * |[<!-- language="C" -->
+ * // Notice that these are initialized to the empty list.
  * GList *string_list = NULL, *number_list = NULL;
  *
- * /&ast; This is a list of strings. &ast;/
+ * // This is a list of strings.
  * string_list = g_list_append (string_list, "first");
  * string_list = g_list_append (string_list, "second");
  * 
- * /&ast; This is a list of integers. &ast;/
+ * // This is a list of integers.
  * number_list = g_list_append (number_list, GINT_TO_POINTER (27));
  * number_list = g_list_append (number_list, GINT_TO_POINTER (14));
  * ]|
@@ -288,8 +285,8 @@ g_list_append (GList    *list,
  * Note that the return value is the new start of the list,
  * which will have changed, so make sure you store the new value. 
  *
- * |[ 
- * /&ast; Notice that it is initialized to the empty list. &ast;/
+ * |[<!-- language="C" -->
+ * // Notice that it is initialized to the empty list.
  * GList *list = NULL;
  *
  * list = g_list_prepend (list, "last");
@@ -436,7 +433,7 @@ g_list_insert_before (GList    *list,
  *
  * This function is for example used to move an element in the list.
  * The following example moves an element to the top of the list:
- * |[
+ * |[<!-- language="C" -->
  * list = g_list_remove_link (list, llink);
  * list = g_list_concat (llink, list);
  * ]|
@@ -578,7 +575,7 @@ g_list_remove_all (GList         *list,
  * This function is for example used to move an element in the list
  * (see the example for g_list_concat()) or to remove an element in
  * the list before freeing its data:
- * |[
+ * |[<!-- language="C" --> 
  * list = g_list_remove_link (list, llink);
  * free_some_data_that_may_access_the_list_again (llink->data);
  * g_list_free (llink);
@@ -650,12 +647,12 @@ g_list_copy (GList *list)
  * if the copy function takes only one argument.
  *
  * For instance, if @list holds a list of GObjects, you can do:
- * |[
+ * |[<!-- language="C" -->   
  * another_list = g_list_copy_deep (list, (GCopyFunc) g_object_ref, NULL);
  * ]|
  *
  * And, to entirely free the new list, you could do:
- * |[
+ * |[<!-- language="C" --> 
  * g_list_free_full (another_list, g_object_unref);
  * ]|
  *
@@ -1198,7 +1195,7 @@ g_list_sort_real (GList    *list,
  * value comes before the second, 0 if they are equal, or a positive
  * integer if the first value comes after the second.
  *
- * Returns: negative value if @a &lt; @b; zero if @a = @b; positive
+ * Returns: negative value if @a < @b; zero if @a = @b; positive
  *          value if @a > @b
  */
 GList *
@@ -1230,7 +1227,7 @@ g_list_sort (GList        *list,
  * value comes before the second, 0 if they are equal, or a positive
  * integer if the first value comes after the second.
  *
- * Returns: negative value if @a &lt; @b; zero if @a = @b; positive
+ * Returns: negative value if @a < @b; zero if @a = @b; positive
  *          value if @a > @b
  */
 GList *