<refentry id="glib-Double-ended-Queues">
<refmeta>
<refentrytitle role="top_of_page" id="glib-Double-ended-Queues.top_of_page">Double-ended Queues</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Double-ended Queues</refname>
<refpurpose>double-ended queue data structure</refpurpose>
</refnamediv>

<refsynopsisdiv id="glib-Double-ended-Queues.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;glib.h&gt;

                    <link linkend="GQueue">GQueue</link>;
<link linkend="GQueue">GQueue</link>*             <link linkend="g-queue-new">g_queue_new</link>                         (void);
<link linkend="void">void</link>                <link linkend="g-queue-free">g_queue_free</link>                        (<link linkend="GQueue">GQueue</link> *queue);
#define             <link linkend="G-QUEUE-INIT--CAPS">G_QUEUE_INIT</link>
<link linkend="void">void</link>                <link linkend="g-queue-init">g_queue_init</link>                        (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="void">void</link>                <link linkend="g-queue-clear">g_queue_clear</link>                       (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="gboolean">gboolean</link>            <link linkend="g-queue-is-empty">g_queue_is_empty</link>                    (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="guint">guint</link>               <link linkend="g-queue-get-length">g_queue_get_length</link>                  (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="void">void</link>                <link linkend="g-queue-reverse">g_queue_reverse</link>                     (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="GQueue">GQueue</link> *            <link linkend="g-queue-copy">g_queue_copy</link>                        (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="void">void</link>                <link linkend="g-queue-foreach">g_queue_foreach</link>                     (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GFunc">GFunc</link> func,
                                                         <link linkend="gpointer">gpointer</link> user_data);
<link linkend="GList">GList</link> *             <link linkend="g-queue-find">g_queue_find</link>                        (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);
<link linkend="GList">GList</link> *             <link linkend="g-queue-find-custom">g_queue_find_custom</link>                 (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data,
                                                         <link linkend="GCompareFunc">GCompareFunc</link> func);
<link linkend="void">void</link>                <link linkend="g-queue-sort">g_queue_sort</link>                        (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GCompareDataFunc">GCompareDataFunc</link> compare_func,
                                                         <link linkend="gpointer">gpointer</link> user_data);
<link linkend="void">void</link>                <link linkend="g-queue-push-head">g_queue_push_head</link>                   (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-push-tail">g_queue_push_tail</link>                   (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-push-nth">g_queue_push_nth</link>                    (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data,
                                                         <link linkend="gint">gint</link> n);
<link linkend="gpointer">gpointer</link>            <link linkend="g-queue-pop-head">g_queue_pop_head</link>                    (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="gpointer">gpointer</link>            <link linkend="g-queue-pop-tail">g_queue_pop_tail</link>                    (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="gpointer">gpointer</link>            <link linkend="g-queue-pop-nth">g_queue_pop_nth</link>                     (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);
<link linkend="gpointer">gpointer</link>            <link linkend="g-queue-peek-head">g_queue_peek_head</link>                   (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="gpointer">gpointer</link>            <link linkend="g-queue-peek-tail">g_queue_peek_tail</link>                   (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="gpointer">gpointer</link>            <link linkend="g-queue-peek-nth">g_queue_peek_nth</link>                    (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);
<link linkend="gint">gint</link>                <link linkend="g-queue-index">g_queue_index</link>                       (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-remove">g_queue_remove</link>                      (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-remove-all">g_queue_remove_all</link>                  (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-insert-before">g_queue_insert_before</link>               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *sibling,
                                                         <link linkend="gpointer">gpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-insert-after">g_queue_insert_after</link>                (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *sibling,
                                                         <link linkend="gpointer">gpointer</link> data);
<link linkend="void">void</link>                <link linkend="g-queue-insert-sorted">g_queue_insert_sorted</link>               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data,
                                                         <link linkend="GCompareDataFunc">GCompareDataFunc</link> func,
                                                         <link linkend="gpointer">gpointer</link> user_data);
<link linkend="void">void</link>                <link linkend="g-queue-push-head-link">g_queue_push_head_link</link>              (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);
<link linkend="void">void</link>                <link linkend="g-queue-push-tail-link">g_queue_push_tail_link</link>              (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);
<link linkend="void">void</link>                <link linkend="g-queue-push-nth-link">g_queue_push_nth_link</link>               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gint">gint</link> n,
                                                         <link linkend="GList">GList</link> *link_);
<link linkend="GList">GList</link>*              <link linkend="g-queue-pop-head-link">g_queue_pop_head_link</link>               (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="GList">GList</link>*              <link linkend="g-queue-pop-tail-link">g_queue_pop_tail_link</link>               (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="GList">GList</link>*              <link linkend="g-queue-pop-nth-link">g_queue_pop_nth_link</link>                (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);
<link linkend="GList">GList</link>*              <link linkend="g-queue-peek-head-link">g_queue_peek_head_link</link>              (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="GList">GList</link>*              <link linkend="g-queue-peek-tail-link">g_queue_peek_tail_link</link>              (<link linkend="GQueue">GQueue</link> *queue);
<link linkend="GList">GList</link>*              <link linkend="g-queue-peek-nth-link">g_queue_peek_nth_link</link>               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);
<link linkend="gint">gint</link>                <link linkend="g-queue-link-index">g_queue_link_index</link>                  (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);
<link linkend="void">void</link>                <link linkend="g-queue-unlink">g_queue_unlink</link>                      (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);
<link linkend="void">void</link>                <link linkend="g-queue-delete-link">g_queue_delete_link</link>                 (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);
</synopsis>
</refsynopsisdiv>









<refsect1 id="glib-Double-ended-Queues.description" role="desc">
<title role="desc.title">Description</title>
<para>
The <link linkend="GQueue"><type>GQueue</type></link> structure and its associated functions provide a standard
queue data structure. Internally, <link linkend="GQueue"><type>GQueue</type></link> uses the same data structure as
<link linkend="GList"><type>GList</type></link> to store elements.
</para>
<para>
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.
</para>
<para>
To create a new <link linkend="GQueue"><type>GQueue</type></link>, use <link linkend="g-queue-new"><function>g_queue_new()</function></link>.
</para>
<para>
To initialize a statically-allocated <link linkend="GQueue"><type>GQueue</type></link>, use <link linkend="G-QUEUE-INIT--CAPS"><type>G_QUEUE_INIT</type></link> or
<link linkend="g-queue-init"><function>g_queue_init()</function></link>.
</para>
<para>
To add elements, use <link linkend="g-queue-push-head"><function>g_queue_push_head()</function></link>, <link linkend="g-queue-push-head-link"><function>g_queue_push_head_link()</function></link>,
<link linkend="g-queue-push-tail"><function>g_queue_push_tail()</function></link> and <link linkend="g-queue-push-tail-link"><function>g_queue_push_tail_link()</function></link>.
</para>
<para>
To remove elements, use <link linkend="g-queue-pop-head"><function>g_queue_pop_head()</function></link> and <link linkend="g-queue-pop-tail"><function>g_queue_pop_tail()</function></link>.
</para>
<para>
To free the entire queue, use <link linkend="g-queue-free"><function>g_queue_free()</function></link>.
</para>
</refsect1>

<refsect1 id="glib-Double-ended-Queues.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GQueue" role="struct">
<title>GQueue</title>
<indexterm zone="GQueue"><primary sortas="Queue">GQueue</primary></indexterm><programlisting>typedef struct {
  GList *head;
  GList *tail;
  guint  length;
} GQueue;
</programlisting>
<para>
Contains the public fields of a <link linkend="glib-queues">Queue</link>.
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="GList">GList</link>&#160;*<structfield>head</structfield>;</term>
<listitem><simpara>a pointer to the first element of the queue.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GList">GList</link>&#160;*<structfield>tail</structfield>;</term>
<listitem><simpara>a pointer to the last element of the queue.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint">guint</link>&#160;<structfield>length</structfield>;</term>
<listitem><simpara>the number of elements in the queue.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-new" role="function">
<title>g_queue_new ()</title>
<indexterm zone="g-queue-new"><primary sortas="queue_new">g_queue_new</primary></indexterm><programlisting><link linkend="GQueue">GQueue</link>*             g_queue_new                         (void);</programlisting>
<para>
Creates a new <link linkend="GQueue"><type>GQueue</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a new <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-free" role="function">
<title>g_queue_free ()</title>
<indexterm zone="g-queue-free"><primary sortas="queue_free">g_queue_free</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_free                        (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Frees the memory allocated for the <link linkend="GQueue"><type>GQueue</type></link>. Only call this function if
<parameter>queue</parameter> was created with <link linkend="g-queue-new"><function>g_queue_new()</function></link>. If queue elements contain
dynamically-allocated memory, they should be freed first.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="G-QUEUE-INIT--CAPS" role="macro" condition="since:2.14">
<title>G_QUEUE_INIT</title>
<indexterm zone="G-QUEUE-INIT--CAPS" role="2.14"><primary sortas="QUEUE_INIT">G_QUEUE_INIT</primary></indexterm><programlisting>#define G_QUEUE_INIT { NULL, NULL, 0 }
</programlisting>
<para>
A statically-allocated <link linkend="GQueue"><type>GQueue</type></link> must be initialized with this macro before it
can be used.  This macro can be used to initialize a variable, but it cannot
be assigned to a variable.  In that case you have to use <link linkend="g-queue-init"><function>g_queue_init()</function></link>.
</para>
<informalexample>
<programlisting>
GQueue my_queue = G_QUEUE_INIT;
</programlisting>
</informalexample><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-queue-init" role="function" condition="since:2.14">
<title>g_queue_init ()</title>
<indexterm zone="g-queue-init" role="2.14"><primary sortas="queue_init">g_queue_init</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_init                        (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
A statically-allocated <link linkend="GQueue"><type>GQueue</type></link> must be initialized with this function
before it can be used. Alternatively you can initialize it with
<link linkend="G-QUEUE-INIT--CAPS"><type>G_QUEUE_INIT</type></link>. It is not necessary to initialize queues created with
<link linkend="g-queue-new"><function>g_queue_new()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> an uninitialized <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-queue-clear" role="function" condition="since:2.14">
<title>g_queue_clear ()</title>
<indexterm zone="g-queue-clear" role="2.14"><primary sortas="queue_clear">g_queue_clear</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_clear                       (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Removes all the elements in <parameter>queue</parameter>. If queue elements contain
dynamically-allocated memory, they should be freed first.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.14</para></refsect2>
<refsect2 id="g-queue-is-empty" role="function">
<title>g_queue_is_empty ()</title>
<indexterm zone="g-queue-is-empty"><primary sortas="queue_is_empty">g_queue_is_empty</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_queue_is_empty                    (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the queue is empty.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the queue is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-get-length" role="function" condition="since:2.4">
<title>g_queue_get_length ()</title>
<indexterm zone="g-queue-get-length" role="2.4"><primary sortas="queue_get_length">g_queue_get_length</primary></indexterm><programlisting><link linkend="guint">guint</link>               g_queue_get_length                  (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Returns the number of items in <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The number of items in <parameter>queue</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-reverse" role="function" condition="since:2.4">
<title>g_queue_reverse ()</title>
<indexterm zone="g-queue-reverse" role="2.4"><primary sortas="queue_reverse">g_queue_reverse</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_reverse                     (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Reverses the order of the items in <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-copy" role="function" condition="since:2.4">
<title>g_queue_copy ()</title>
<indexterm zone="g-queue-copy" role="2.4"><primary sortas="queue_copy">g_queue_copy</primary></indexterm><programlisting><link linkend="GQueue">GQueue</link> *            g_queue_copy                        (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Copies a <parameter>queue</parameter>. Note that is a shallow copy. If the elements in the
queue consist of pointers to data, the pointers are copied, but the
actual data is not.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A copy of <parameter>queue</parameter>

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-foreach" role="function" condition="since:2.4">
<title>g_queue_foreach ()</title>
<indexterm zone="g-queue-foreach" role="2.4"><primary sortas="queue_foreach">g_queue_foreach</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_foreach                     (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GFunc">GFunc</link> func,
                                                         <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
Calls <parameter>func</parameter> for each element in the queue passing <parameter>user_data</parameter> to the
function.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>func</parameter>&#160;:</term>
<listitem><simpara> the function to call for each element's data
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data to pass to <parameter>func</parameter>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-find" role="function" condition="since:2.4">
<title>g_queue_find ()</title>
<indexterm zone="g-queue-find" role="2.4"><primary sortas="queue_find">g_queue_find</primary></indexterm><programlisting><link linkend="GList">GList</link> *             g_queue_find                        (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);</programlisting>
<para>
Finds the first link in <parameter>queue</parameter> which contains <parameter>data</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> data to find
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The first link in <parameter>queue</parameter> which contains <parameter>data</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-find-custom" role="function" condition="since:2.4">
<title>g_queue_find_custom ()</title>
<indexterm zone="g-queue-find-custom" role="2.4"><primary sortas="queue_find_custom">g_queue_find_custom</primary></indexterm><programlisting><link linkend="GList">GList</link> *             g_queue_find_custom                 (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data,
                                                         <link linkend="GCompareFunc">GCompareFunc</link> func);</programlisting>
<para>
Finds an element in a <link linkend="GQueue"><type>GQueue</type></link>, using a supplied function to find the
desired element. It iterates over the queue, calling the given function
which should return 0 when the desired element is found. The function
takes two gconstpointer arguments, the <link linkend="GQueue"><type>GQueue</type></link> element's data as the
first argument and the given user data as the second argument.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>func</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>func</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GCompareFunc"><type>GCompareFunc</type></link> to call for each element. It should return 0
when the desired element is found
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The found link, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if it wasn't found

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-sort" role="function" condition="since:2.4">
<title>g_queue_sort ()</title>
<indexterm zone="g-queue-sort" role="2.4"><primary sortas="queue_sort">g_queue_sort</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_sort                        (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GCompareDataFunc">GCompareDataFunc</link> compare_func,
                                                         <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
Sorts <parameter>queue</parameter> using <parameter>compare_func</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>compare_func</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> used to sort <parameter>queue</parameter>. This function
    is passed two elements of the queue and should return 0 if they are
    equal, a negative value if the first comes before the second, and
    a positive value if the second comes before the first.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>compare_func</parameter>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-push-head" role="function">
<title>g_queue_push_head ()</title>
<indexterm zone="g-queue-push-head"><primary sortas="queue_push_head">g_queue_push_head</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_push_head                   (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data);</programlisting>
<para>
Adds a new element at the head of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data for the new element.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-push-tail" role="function">
<title>g_queue_push_tail ()</title>
<indexterm zone="g-queue-push-tail"><primary sortas="queue_push_tail">g_queue_push_tail</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_push_tail                   (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data);</programlisting>
<para>
Adds a new element at the tail of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data for the new element.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-push-nth" role="function" condition="since:2.4">
<title>g_queue_push_nth ()</title>
<indexterm zone="g-queue-push-nth" role="2.4"><primary sortas="queue_push_nth">g_queue_push_nth</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_push_nth                    (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data,
                                                         <link linkend="gint">gint</link> n);</programlisting>
<para>
Inserts a new element into <parameter>queue</parameter> at the given position</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data for the new element
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> the position to insert the new element. If <parameter>n</parameter> is negative or
    larger than the number of elements in the <parameter>queue</parameter>, the element is
    added to the end of the queue.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-pop-head" role="function">
<title>g_queue_pop_head ()</title>
<indexterm zone="g-queue-pop-head"><primary sortas="queue_pop_head">g_queue_pop_head</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_queue_pop_head                    (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Removes the first element of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the data of the first element in the queue, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the queue
  is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-pop-tail" role="function">
<title>g_queue_pop_tail ()</title>
<indexterm zone="g-queue-pop-tail"><primary sortas="queue_pop_tail">g_queue_pop_tail</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_queue_pop_tail                    (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Removes the last element of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the data of the last element in the queue, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the queue
  is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-pop-nth" role="function" condition="since:2.4">
<title>g_queue_pop_nth ()</title>
<indexterm zone="g-queue-pop-nth" role="2.4"><primary sortas="queue_pop_nth">g_queue_pop_nth</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_queue_pop_nth                     (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);</programlisting>
<para>
Removes the <parameter>n</parameter>'th element of <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> the position of the element.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the element's data, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>n</parameter> is off the end of <parameter>queue</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-peek-head" role="function">
<title>g_queue_peek_head ()</title>
<indexterm zone="g-queue-peek-head"><primary sortas="queue_peek_head">g_queue_peek_head</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_queue_peek_head                   (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Returns the first element of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the data of the first element in the queue, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the queue
  is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-peek-tail" role="function">
<title>g_queue_peek_tail ()</title>
<indexterm zone="g-queue-peek-tail"><primary sortas="queue_peek_tail">g_queue_peek_tail</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_queue_peek_tail                   (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Returns the last element of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the data of the last element in the queue, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the queue
  is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-peek-nth" role="function" condition="since:2.4">
<title>g_queue_peek_nth ()</title>
<indexterm zone="g-queue-peek-nth" role="2.4"><primary sortas="queue_peek_nth">g_queue_peek_nth</primary></indexterm><programlisting><link linkend="gpointer">gpointer</link>            g_queue_peek_nth                    (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);</programlisting>
<para>
Returns the <parameter>n</parameter>'th element of <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> the position of the element.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The data for the <parameter>n</parameter>'th element of <parameter>queue</parameter>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>n</parameter> is
  off the end of <parameter>queue</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-index" role="function" condition="since:2.4">
<title>g_queue_index ()</title>
<indexterm zone="g-queue-index" role="2.4"><primary sortas="queue_index">g_queue_index</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_queue_index                       (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);</programlisting>
<para>
Returns the position of the first element in <parameter>queue</parameter> which contains <parameter>data</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data to find.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The position of the first element in <parameter>queue</parameter> which contains <parameter>data</parameter>, or -1 if no element in <parameter>queue</parameter> contains <parameter>data</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-remove" role="function" condition="since:2.4">
<title>g_queue_remove ()</title>
<indexterm zone="g-queue-remove" role="2.4"><primary sortas="queue_remove">g_queue_remove</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_remove                      (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);</programlisting>
<para>
Removes the first element in <parameter>queue</parameter> that contains <parameter>data</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> data to remove.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-remove-all" role="function" condition="since:2.4">
<title>g_queue_remove_all ()</title>
<indexterm zone="g-queue-remove-all" role="2.4"><primary sortas="queue_remove_all">g_queue_remove_all</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_remove_all                  (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gconstpointer">gconstpointer</link> data);</programlisting>
<para>
Remove all elemeents in <parameter>queue</parameter> which contains <parameter>data</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> data to remove
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-insert-before" role="function" condition="since:2.4">
<title>g_queue_insert_before ()</title>
<indexterm zone="g-queue-insert-before" role="2.4"><primary sortas="queue_insert_before">g_queue_insert_before</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_insert_before               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *sibling,
                                                         <link linkend="gpointer">gpointer</link> data);</programlisting>
<para>
Inserts <parameter>data</parameter> into <parameter>queue</parameter> before <parameter>sibling</parameter>.
</para>
<para>
<parameter>sibling</parameter> must be part of <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sibling</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GList"><type>GList</type></link> link that <emphasis>must</emphasis> be part of <parameter>queue</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data to insert
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-insert-after" role="function" condition="since:2.4">
<title>g_queue_insert_after ()</title>
<indexterm zone="g-queue-insert-after" role="2.4"><primary sortas="queue_insert_after">g_queue_insert_after</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_insert_after                (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *sibling,
                                                         <link linkend="gpointer">gpointer</link> data);</programlisting>
<para>
Inserts <parameter>data</parameter> into <parameter>queue</parameter> after <parameter>sibling</parameter>
</para>
<para>
<parameter>sibling</parameter> must be part of <parameter>queue</parameter></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sibling</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GList"><type>GList</type></link> link that <emphasis>must</emphasis> be part of <parameter>queue</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data to insert
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-insert-sorted" role="function" condition="since:2.4">
<title>g_queue_insert_sorted ()</title>
<indexterm zone="g-queue-insert-sorted" role="2.4"><primary sortas="queue_insert_sorted">g_queue_insert_sorted</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_insert_sorted               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gpointer">gpointer</link> data,
                                                         <link linkend="GCompareDataFunc">GCompareDataFunc</link> func,
                                                         <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
Inserts <parameter>data</parameter> into <parameter>queue</parameter> using <parameter>func</parameter> to determine the new position.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>data</parameter>&#160;:</term>
<listitem><simpara> the data to insert
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>func</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> used to compare elements in the queue. It is
    called with two elements of the <parameter>queue</parameter> and <parameter>user_data</parameter>. It should
    return 0 if the elements are equal, a negative value if the first
    element comes before the second, and a positive value if the second
    element comes before the first.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara> user data passed to <parameter>func</parameter>.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-push-head-link" role="function">
<title>g_queue_push_head_link ()</title>
<indexterm zone="g-queue-push-head-link"><primary sortas="queue_push_head_link">g_queue_push_head_link</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_push_head_link              (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);</programlisting>
<para>
Adds a new element at the head of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>link_</parameter>&#160;:</term>
<listitem><simpara> a single <link linkend="GList"><type>GList</type></link> element, <emphasis>not</emphasis> a list with
    more than one element.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-push-tail-link" role="function">
<title>g_queue_push_tail_link ()</title>
<indexterm zone="g-queue-push-tail-link"><primary sortas="queue_push_tail_link">g_queue_push_tail_link</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_push_tail_link              (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);</programlisting>
<para>
Adds a new element at the tail of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>link_</parameter>&#160;:</term>
<listitem><simpara> a single <link linkend="GList"><type>GList</type></link> element, <emphasis>not</emphasis> a list with
  more than one element.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-push-nth-link" role="function" condition="since:2.4">
<title>g_queue_push_nth_link ()</title>
<indexterm zone="g-queue-push-nth-link" role="2.4"><primary sortas="queue_push_nth_link">g_queue_push_nth_link</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_push_nth_link               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="gint">gint</link> n,
                                                         <link linkend="GList">GList</link> *link_);</programlisting>
<para>
Inserts <parameter>link</parameter> into <parameter>queue</parameter> at the given position.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> the position to insert the link. If this is negative or larger than
    the number of elements in <parameter>queue</parameter>, the link is added to the end of
    <parameter>queue</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>link_</parameter>&#160;:</term>
<listitem><simpara> the link to add to <parameter>queue</parameter>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-pop-head-link" role="function">
<title>g_queue_pop_head_link ()</title>
<indexterm zone="g-queue-pop-head-link"><primary sortas="queue_pop_head_link">g_queue_pop_head_link</primary></indexterm><programlisting><link linkend="GList">GList</link>*              g_queue_pop_head_link               (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Removes the first element of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the <link linkend="GList"><type>GList</type></link> element at the head of the queue, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the queue
  is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-pop-tail-link" role="function">
<title>g_queue_pop_tail_link ()</title>
<indexterm zone="g-queue-pop-tail-link"><primary sortas="queue_pop_tail_link">g_queue_pop_tail_link</primary></indexterm><programlisting><link linkend="GList">GList</link>*              g_queue_pop_tail_link               (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Removes the last element of the queue.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the <link linkend="GList"><type>GList</type></link> element at the tail of the queue, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the queue
  is empty.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g-queue-pop-nth-link" role="function" condition="since:2.4">
<title>g_queue_pop_nth_link ()</title>
<indexterm zone="g-queue-pop-nth-link" role="2.4"><primary sortas="queue_pop_nth_link">g_queue_pop_nth_link</primary></indexterm><programlisting><link linkend="GList">GList</link>*              g_queue_pop_nth_link                (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);</programlisting>
<para>
Removes and returns the link at the given position.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> the link's position
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The <parameter>n</parameter>'th link, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>n</parameter> is off the end of <parameter>queue</parameter>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-peek-head-link" role="function" condition="since:2.4">
<title>g_queue_peek_head_link ()</title>
<indexterm zone="g-queue-peek-head-link" role="2.4"><primary sortas="queue_peek_head_link">g_queue_peek_head_link</primary></indexterm><programlisting><link linkend="GList">GList</link>*              g_queue_peek_head_link              (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Returns the first link in <parameter>queue</parameter></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the first link in <parameter>queue</parameter>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>queue</parameter> is empty

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-peek-tail-link" role="function" condition="since:2.4">
<title>g_queue_peek_tail_link ()</title>
<indexterm zone="g-queue-peek-tail-link" role="2.4"><primary sortas="queue_peek_tail_link">g_queue_peek_tail_link</primary></indexterm><programlisting><link linkend="GList">GList</link>*              g_queue_peek_tail_link              (<link linkend="GQueue">GQueue</link> *queue);</programlisting>
<para>
Returns the last link <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the last link in <parameter>queue</parameter>, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>queue</parameter> is empty

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-peek-nth-link" role="function" condition="since:2.4">
<title>g_queue_peek_nth_link ()</title>
<indexterm zone="g-queue-peek-nth-link" role="2.4"><primary sortas="queue_peek_nth_link">g_queue_peek_nth_link</primary></indexterm><programlisting><link linkend="GList">GList</link>*              g_queue_peek_nth_link               (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="guint">guint</link> n);</programlisting>
<para>
Returns the link at the given position</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&#160;:</term>
<listitem><simpara> the position of the link
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The link at the <parameter>n</parameter>'th position, or <link linkend="NULL--CAPS"><literal>NULL</literal></link> if <parameter>n</parameter> is off the
end of the list

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-link-index" role="function" condition="since:2.4">
<title>g_queue_link_index ()</title>
<indexterm zone="g-queue-link-index" role="2.4"><primary sortas="queue_link_index">g_queue_link_index</primary></indexterm><programlisting><link linkend="gint">gint</link>                g_queue_link_index                  (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);</programlisting>
<para>
Returns the position of <parameter>link_</parameter> in <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="Gqueue"><type>Gqueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>link_</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="GList"><type>GList</type></link> link
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The position of <parameter>link_</parameter>, or -1 if the link is
not part of <parameter>queue</parameter>

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-unlink" role="function" condition="since:2.4">
<title>g_queue_unlink ()</title>
<indexterm zone="g-queue-unlink" role="2.4"><primary sortas="queue_unlink">g_queue_unlink</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_unlink                      (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);</programlisting>
<para>
Unlinks <parameter>link_</parameter> so that it will no longer be part of <parameter>queue</parameter>. The link is
not freed.
</para>
<para>
<parameter>link_</parameter> must be part of <parameter>queue</parameter>,</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>link_</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GList"><type>GList</type></link> link that <emphasis>must</emphasis> be part of <parameter>queue</parameter>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>
<refsect2 id="g-queue-delete-link" role="function" condition="since:2.4">
<title>g_queue_delete_link ()</title>
<indexterm zone="g-queue-delete-link" role="2.4"><primary sortas="queue_delete_link">g_queue_delete_link</primary></indexterm><programlisting><link linkend="void">void</link>                g_queue_delete_link                 (<link linkend="GQueue">GQueue</link> *queue,
                                                         <link linkend="GList">GList</link> *link_);</programlisting>
<para>
Removes <parameter>link_</parameter> from <parameter>queue</parameter> and frees it.
</para>
<para>
<parameter>link_</parameter> must be part of <parameter>queue</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>queue</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GQueue"><type>GQueue</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>link_</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GList"><type>GList</type></link> link that <emphasis>must</emphasis> be part of <parameter>queue</parameter>
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.4</para></refsect2>

</refsect1>




</refentry>
