<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<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>

<refsect1 id="glib-Double-ended-Queues.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GQueue"><returnvalue>GQueue</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-new">g_queue_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-free">g_queue_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-free-full">g_queue_free_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-init">g_queue_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-clear">g_queue_clear</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-clear-full">g_queue_clear_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-is-empty">g_queue_is_empty</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-get-length">g_queue_get_length</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-reverse">g_queue_reverse</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GQueue"><returnvalue>GQueue</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-copy">g_queue_copy</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-foreach">g_queue_foreach</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-find">g_queue_find</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-find-custom">g_queue_find_custom</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-sort">g_queue_sort</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-push-head">g_queue_push_head</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-push-tail">g_queue_push_tail</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-push-nth">g_queue_push_nth</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-pop-head">g_queue_pop_head</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-pop-tail">g_queue_pop_tail</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-pop-nth">g_queue_pop_nth</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-peek-head">g_queue_peek_head</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-peek-tail">g_queue_peek_tail</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-peek-nth">g_queue_peek_nth</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-index">g_queue_index</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-remove">g_queue_remove</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-remove-all">g_queue_remove_all</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-insert-before">g_queue_insert_before</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-insert-before-link">g_queue_insert_before_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-insert-after">g_queue_insert_after</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-insert-after-link">g_queue_insert_after_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-insert-sorted">g_queue_insert_sorted</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-push-head-link">g_queue_push_head_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-push-tail-link">g_queue_push_tail_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-push-nth-link">g_queue_push_nth_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-pop-head-link">g_queue_pop_head_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-pop-tail-link">g_queue_pop_tail_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-pop-nth-link">g_queue_pop_nth_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-peek-head-link">g_queue_peek_head_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-peek-tail-link">g_queue_peek_tail_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-queue-peek-nth-link">g_queue_peek_nth_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-link-index">g_queue_link_index</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-unlink">g_queue_unlink</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-queue-delete-link">g_queue_delete_link</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-Double-ended-Queues.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GQueue">GQueue</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-QUEUE-INIT:CAPS">G_QUEUE_INIT</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-Double-ended-Queues.includes"><title>Includes</title><synopsis>#include &lt;gmodule.h&gt;
</synopsis></refsect1>

<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, GQueue uses the same data structure
as <link linkend="GList"><type>GList</type></link> to store elements with the same complexity over
insertion/deletion (O(1)) and access/search (O(n)) operations.</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>As with all other GLib data structures, <link linkend="GQueue"><type>GQueue</type></link> is not thread-safe.
For a thread-safe queue, use <link linkend="GAsyncQueue"><type>GAsyncQueue</type></link>.</para>
<para>To create a new GQueue, use <link linkend="g-queue-new"><function>g_queue_new()</function></link>.</para>
<para>To initialize a statically-allocated GQueue, 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.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-queue-new" role="function">
<title>g_queue_new&#160;()</title>
<indexterm zone="g-queue-new"><primary sortas="queue_new">g_queue_new</primary></indexterm>
<programlisting language="C"><link linkend="GQueue"><returnvalue>GQueue</returnvalue></link>&#160;*
g_queue_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new <link linkend="GQueue"><type>GQueue</type></link>.</para>
<refsect3 id="g-queue-new.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GQueue"><type>GQueue</type></link></para>
</refsect3></refsect2>
<refsect2 id="g-queue-free" role="function">
<title>g_queue_free&#160;()</title>
<indexterm zone="g-queue-free"><primary sortas="queue_free">g_queue_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_free (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</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>If queue elements contain dynamically-allocated memory, you should
either use <link linkend="g-queue-free-full"><function>g_queue_free_full()</function></link> or free them manually first.</para>
<refsect3 id="g-queue-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-queue-free-full" role="function" condition="since:2.32">
<title>g_queue_free_full&#160;()</title>
<indexterm zone="g-queue-free-full" role="2.32"><primary sortas="queue_free_full">g_queue_free_full</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_free_full (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                   <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> free_func</parameter>);</programlisting>
<para>Convenience method, which frees all the memory used by a <link linkend="GQueue"><type>GQueue</type></link>,
and calls the specified destroy function on every element's data.</para>
<para><parameter>free_func</parameter>
 should not modify the queue (eg, by removing the freed
element from it).</para>
<refsect3 id="g-queue-free-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>free_func</para></entry>
<entry role="parameter_description"><para>the function to be called to free each element's data</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.32">2.32</link></para></refsect2>
<refsect2 id="g-queue-init" role="function" condition="since:2.14">
<title>g_queue_init&#160;()</title>
<indexterm zone="g-queue-init" role="2.14"><primary sortas="queue_init">g_queue_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_init (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</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>
<refsect3 id="g-queue-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>an uninitialized <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.14">2.14</link></para></refsect2>
<refsect2 id="g-queue-clear" role="function" condition="since:2.14">
<title>g_queue_clear&#160;()</title>
<indexterm zone="g-queue-clear" role="2.14"><primary sortas="queue_clear">g_queue_clear</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_clear (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Removes all the elements in <parameter>queue</parameter>
. If queue elements contain
dynamically-allocated memory, they should be freed first.</para>
<refsect3 id="g-queue-clear.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.14">2.14</link></para></refsect2>
<refsect2 id="g-queue-clear-full" role="function" condition="since:2.60">
<title>g_queue_clear_full&#160;()</title>
<indexterm zone="g-queue-clear-full" role="2.60"><primary sortas="queue_clear_full">g_queue_clear_full</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_clear_full (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                    <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> free_func</parameter>);</programlisting>
<para>Convenience method, which frees all the memory used by a <link linkend="GQueue"><type>GQueue</type></link>,
and calls the provided <parameter>free_func</parameter>
 on each item in the <link linkend="GQueue"><type>GQueue</type></link>.</para>
<refsect3 id="g-queue-clear-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a pointer to a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>free_func</para></entry>
<entry role="parameter_description"><para>the function to be called to free memory allocated. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.60">2.60</link></para></refsect2>
<refsect2 id="g-queue-is-empty" role="function">
<title>g_queue_is_empty&#160;()</title>
<indexterm zone="g-queue-is-empty"><primary sortas="queue_is_empty">g_queue_is_empty</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_queue_is_empty (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the queue is empty.</para>
<refsect3 id="g-queue-is-empty.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-is-empty.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the queue is empty</para>
</refsect3></refsect2>
<refsect2 id="g-queue-get-length" role="function" condition="since:2.4">
<title>g_queue_get_length&#160;()</title>
<indexterm zone="g-queue-get-length" role="2.4"><primary sortas="queue_get_length">g_queue_get_length</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_queue_get_length (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Returns the number of items in <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-get-length.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-get-length.returns" role="returns">
<title>Returns</title>
<para> the number of items in <parameter>queue</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-reverse" role="function" condition="since:2.4">
<title>g_queue_reverse&#160;()</title>
<indexterm zone="g-queue-reverse" role="2.4"><primary sortas="queue_reverse">g_queue_reverse</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_reverse (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Reverses the order of the items in <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-reverse.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-copy" role="function" condition="since:2.4">
<title>g_queue_copy&#160;()</title>
<indexterm zone="g-queue-copy" role="2.4"><primary sortas="queue_copy">g_queue_copy</primary></indexterm>
<programlisting language="C"><link linkend="GQueue"><returnvalue>GQueue</returnvalue></link>&#160;*
g_queue_copy (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</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>
<refsect3 id="g-queue-copy.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-copy.returns" role="returns">
<title>Returns</title>
<para> a copy of <parameter>queue</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-foreach" role="function" condition="since:2.4">
<title>g_queue_foreach&#160;()</title>
<indexterm zone="g-queue-foreach" role="2.4"><primary sortas="queue_foreach">g_queue_foreach</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_foreach (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                 <parameter><link linkend="GFunc"><type>GFunc</type></link> func</parameter>,
                 <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Calls <parameter>func</parameter>
 for each element in the queue passing <parameter>user_data</parameter>
 to the
function.</para>
<para>It is safe for <parameter>func</parameter>
 to remove the element from <parameter>queue</parameter>
, but it must
not modify any part of the queue after that element.</para>
<refsect3 id="g-queue-foreach.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>the function to call for each element's data</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-find" role="function" condition="since:2.4">
<title>g_queue_find&#160;()</title>
<indexterm zone="g-queue-find" role="2.4"><primary sortas="queue_find">g_queue_find</primary></indexterm>
<programlisting language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_find (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
              <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> data</parameter>);</programlisting>
<para>Finds the first link in <parameter>queue</parameter>
 which contains <parameter>data</parameter>
.</para>
<refsect3 id="g-queue-find.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to find</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-find.returns" role="returns">
<title>Returns</title>
<para> the first link in <parameter>queue</parameter>
which contains <parameter>data</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-find-custom" role="function" condition="since:2.4">
<title>g_queue_find_custom&#160;()</title>
<indexterm zone="g-queue-find-custom" role="2.4"><primary sortas="queue_find_custom">g_queue_find_custom</primary></indexterm>
<programlisting language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_find_custom (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                     <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> data</parameter>,
                     <parameter><link linkend="GCompareFunc"><type>GCompareFunc</type></link> func</parameter>);</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>
<refsect3 id="g-queue-find-custom.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>user data passed to <parameter>func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>a <link linkend="GCompareFunc"><type>GCompareFunc</type></link> to call for each element. It should return 0
when the desired element is found</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-find-custom.returns" role="returns">
<title>Returns</title>
<para> the found link, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if it wasn't found</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-sort" role="function" condition="since:2.4">
<title>g_queue_sort&#160;()</title>
<indexterm zone="g-queue-sort" role="2.4"><primary sortas="queue_sort">g_queue_sort</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_sort (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
              <parameter><link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> compare_func</parameter>,
              <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Sorts <parameter>queue</parameter>
 using <parameter>compare_func</parameter>
.</para>
<refsect3 id="g-queue-sort.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>compare_func</para></entry>
<entry role="parameter_description"><para>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.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data passed to <parameter>compare_func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-push-head" role="function">
<title>g_queue_push_head&#160;()</title>
<indexterm zone="g-queue-push-head"><primary sortas="queue_push_head">g_queue_push_head</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_push_head (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                   <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Adds a new element at the head of the queue.</para>
<refsect3 id="g-queue-push-head.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data for the new element.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-queue-push-tail" role="function">
<title>g_queue_push_tail&#160;()</title>
<indexterm zone="g-queue-push-tail"><primary sortas="queue_push_tail">g_queue_push_tail</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_push_tail (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                   <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Adds a new element at the tail of the queue.</para>
<refsect3 id="g-queue-push-tail.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data for the new element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-queue-push-nth" role="function" condition="since:2.4">
<title>g_queue_push_nth&#160;()</title>
<indexterm zone="g-queue-push-nth" role="2.4"><primary sortas="queue_push_nth">g_queue_push_nth</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_push_nth (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                  <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                  <parameter><link linkend="gint"><type>gint</type></link> n</parameter>);</programlisting>
<para>Inserts a new element into <parameter>queue</parameter>
 at the given position.</para>
<refsect3 id="g-queue-push-nth.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data for the new element</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n</para></entry>
<entry role="parameter_description"><para>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.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-pop-head" role="function">
<title>g_queue_pop_head&#160;()</title>
<indexterm zone="g-queue-pop-head"><primary sortas="queue_pop_head">g_queue_pop_head</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_queue_pop_head (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Removes the first element of the queue and returns its data.</para>
<refsect3 id="g-queue-pop-head.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-pop-head.returns" role="returns">
<title>Returns</title>
<para> the data of the first element in the queue, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
if the queue is empty</para>
</refsect3></refsect2>
<refsect2 id="g-queue-pop-tail" role="function">
<title>g_queue_pop_tail&#160;()</title>
<indexterm zone="g-queue-pop-tail"><primary sortas="queue_pop_tail">g_queue_pop_tail</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_queue_pop_tail (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Removes the last element of the queue and returns its data.</para>
<refsect3 id="g-queue-pop-tail.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-pop-tail.returns" role="returns">
<title>Returns</title>
<para> the data of the last element in the queue, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
if the queue is empty</para>
</refsect3></refsect2>
<refsect2 id="g-queue-pop-nth" role="function" condition="since:2.4">
<title>g_queue_pop_nth&#160;()</title>
<indexterm zone="g-queue-pop-nth" role="2.4"><primary sortas="queue_pop_nth">g_queue_pop_nth</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_queue_pop_nth (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                 <parameter><link linkend="guint"><type>guint</type></link> n</parameter>);</programlisting>
<para>Removes the <parameter>n</parameter>
'th element of <parameter>queue</parameter>
 and returns its data.</para>
<refsect3 id="g-queue-pop-nth.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n</para></entry>
<entry role="parameter_description"><para>the position of the element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-pop-nth.returns" role="returns">
<title>Returns</title>
<para> 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>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-peek-head" role="function">
<title>g_queue_peek_head&#160;()</title>
<indexterm zone="g-queue-peek-head"><primary sortas="queue_peek_head">g_queue_peek_head</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_queue_peek_head (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Returns the first element of the queue.</para>
<refsect3 id="g-queue-peek-head.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-peek-head.returns" role="returns">
<title>Returns</title>
<para> the data of the first element in the queue, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
if the queue is empty</para>
</refsect3></refsect2>
<refsect2 id="g-queue-peek-tail" role="function">
<title>g_queue_peek_tail&#160;()</title>
<indexterm zone="g-queue-peek-tail"><primary sortas="queue_peek_tail">g_queue_peek_tail</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_queue_peek_tail (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Returns the last element of the queue.</para>
<refsect3 id="g-queue-peek-tail.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-peek-tail.returns" role="returns">
<title>Returns</title>
<para> the data of the last element in the queue, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
if the queue is empty</para>
</refsect3></refsect2>
<refsect2 id="g-queue-peek-nth" role="function" condition="since:2.4">
<title>g_queue_peek_nth&#160;()</title>
<indexterm zone="g-queue-peek-nth" role="2.4"><primary sortas="queue_peek_nth">g_queue_peek_nth</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_queue_peek_nth (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                  <parameter><link linkend="guint"><type>guint</type></link> n</parameter>);</programlisting>
<para>Returns the <parameter>n</parameter>
'th element of <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-peek-nth.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n</para></entry>
<entry role="parameter_description"><para>the position of the element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-peek-nth.returns" role="returns">
<title>Returns</title>
<para> 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>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-index" role="function" condition="since:2.4">
<title>g_queue_index&#160;()</title>
<indexterm zone="g-queue-index" role="2.4"><primary sortas="queue_index">g_queue_index</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_queue_index (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
               <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> data</parameter>);</programlisting>
<para>Returns the position of the first element in <parameter>queue</parameter>
 which contains <parameter>data</parameter>
.</para>
<refsect3 id="g-queue-index.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data to find</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-index.returns" role="returns">
<title>Returns</title>
<para> 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>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-remove" role="function" condition="since:2.4">
<title>g_queue_remove&#160;()</title>
<indexterm zone="g-queue-remove" role="2.4"><primary sortas="queue_remove">g_queue_remove</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_queue_remove (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> data</parameter>);</programlisting>
<para>Removes the first element in <parameter>queue</parameter>
 that contains <parameter>data</parameter>
.</para>
<refsect3 id="g-queue-remove.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data to remove</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-remove.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>data</parameter>
was found and removed from <parameter>queue</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-remove-all" role="function" condition="since:2.4">
<title>g_queue_remove_all&#160;()</title>
<indexterm zone="g-queue-remove-all" role="2.4"><primary sortas="queue_remove_all">g_queue_remove_all</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_queue_remove_all (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                    <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> data</parameter>);</programlisting>
<para>Remove all elements whose data equals <parameter>data</parameter>
 from <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-remove-all.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data to remove</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-remove-all.returns" role="returns">
<title>Returns</title>
<para> the number of elements removed from <parameter>queue</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-insert-before" role="function" condition="since:2.4">
<title>g_queue_insert_before&#160;()</title>
<indexterm zone="g-queue-insert-before" role="2.4"><primary sortas="queue_insert_before">g_queue_insert_before</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_insert_before (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                       <parameter><link linkend="GList"><type>GList</type></link> *sibling</parameter>,
                       <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</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>
. Since GLib 2.44 a <link linkend="NULL:CAPS"><literal>NULL</literal></link> sibling pushes the
data at the tail of the queue.</para>
<refsect3 id="g-queue-insert-before.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sibling</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link that must be part of <parameter>queue</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to
push at the tail of the queue. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data to insert</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-insert-before-link" role="function" condition="since:2.62">
<title>g_queue_insert_before_link&#160;()</title>
<indexterm zone="g-queue-insert-before-link" role="2.62"><primary sortas="queue_insert_before_link">g_queue_insert_before_link</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_insert_before_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                            <parameter><link linkend="GList"><type>GList</type></link> *sibling</parameter>,
                            <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</programlisting>
<para>Inserts <parameter>link_</parameter>
 into <parameter>queue</parameter>
 before <parameter>sibling</parameter>
.</para>
<para><parameter>sibling</parameter>
 must be part of <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-insert-before-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sibling</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link that must be part of <parameter>queue</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to
push at the tail of the queue. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link to insert which must not be part of any other list.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.62">2.62</link></para></refsect2>
<refsect2 id="g-queue-insert-after" role="function" condition="since:2.4">
<title>g_queue_insert_after&#160;()</title>
<indexterm zone="g-queue-insert-after" role="2.4"><primary sortas="queue_insert_after">g_queue_insert_after</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_insert_after (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                      <parameter><link linkend="GList"><type>GList</type></link> *sibling</parameter>,
                      <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</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>
. Since GLib 2.44 a <link linkend="NULL:CAPS"><literal>NULL</literal></link> sibling pushes the
data at the head of the queue.</para>
<refsect3 id="g-queue-insert-after.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sibling</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link that must be part of <parameter>queue</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to
push at the head of the queue. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data to insert</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-insert-after-link" role="function" condition="since:2.62">
<title>g_queue_insert_after_link&#160;()</title>
<indexterm zone="g-queue-insert-after-link" role="2.62"><primary sortas="queue_insert_after_link">g_queue_insert_after_link</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_insert_after_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                           <parameter><link linkend="GList"><type>GList</type></link> *sibling</parameter>,
                           <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</programlisting>
<para>Inserts <parameter>link_</parameter>
 into <parameter>queue</parameter>
 after <parameter>sibling</parameter>
.</para>
<para><parameter>sibling</parameter>
 must be part of <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-insert-after-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sibling</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link that must be part of <parameter>queue</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to
push at the head of the queue. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link to insert which must not be part of any other list.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.62">2.62</link></para></refsect2>
<refsect2 id="g-queue-insert-sorted" role="function" condition="since:2.4">
<title>g_queue_insert_sorted&#160;()</title>
<indexterm zone="g-queue-insert-sorted" role="2.4"><primary sortas="queue_insert_sorted">g_queue_insert_sorted</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_insert_sorted (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                       <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                       <parameter><link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> func</parameter>,
                       <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>Inserts <parameter>data</parameter>
 into <parameter>queue</parameter>
 using <parameter>func</parameter>
 to determine the new position.</para>
<refsect3 id="g-queue-insert-sorted.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the data to insert</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>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.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data passed to <parameter>func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-push-head-link" role="function">
<title>g_queue_push_head_link&#160;()</title>
<indexterm zone="g-queue-push-head-link"><primary sortas="queue_push_head_link">g_queue_push_head_link</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_push_head_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                        <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</programlisting>
<para>Adds a new element at the head of the queue.</para>
<refsect3 id="g-queue-push-head-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a single <link linkend="GList"><type>GList</type></link> element, not a list with more than one element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-queue-push-tail-link" role="function">
<title>g_queue_push_tail_link&#160;()</title>
<indexterm zone="g-queue-push-tail-link"><primary sortas="queue_push_tail_link">g_queue_push_tail_link</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_push_tail_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                        <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</programlisting>
<para>Adds a new element at the tail of the queue.</para>
<refsect3 id="g-queue-push-tail-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a single <link linkend="GList"><type>GList</type></link> element, not a list with more than one element</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-queue-push-nth-link" role="function" condition="since:2.4">
<title>g_queue_push_nth_link&#160;()</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 language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_push_nth_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> n</parameter>,
                       <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</programlisting>
<para>Inserts <parameter>link</parameter>
 into <parameter>queue</parameter>
 at the given position.</para>
<refsect3 id="g-queue-push-nth-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n</para></entry>
<entry role="parameter_description"><para>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>
.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>the link to add to <parameter>queue</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-pop-head-link" role="function">
<title>g_queue_pop_head_link&#160;()</title>
<indexterm zone="g-queue-pop-head-link"><primary sortas="queue_pop_head_link">g_queue_pop_head_link</primary></indexterm>
<programlisting language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_pop_head_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Removes and returns the first element of the queue.</para>
<refsect3 id="g-queue-pop-head-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-pop-head-link.returns" role="returns">
<title>Returns</title>
<para> 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</para>
</refsect3></refsect2>
<refsect2 id="g-queue-pop-tail-link" role="function">
<title>g_queue_pop_tail_link&#160;()</title>
<indexterm zone="g-queue-pop-tail-link"><primary sortas="queue_pop_tail_link">g_queue_pop_tail_link</primary></indexterm>
<programlisting language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_pop_tail_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Removes and returns the last element of the queue.</para>
<refsect3 id="g-queue-pop-tail-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-pop-tail-link.returns" role="returns">
<title>Returns</title>
<para> 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</para>
</refsect3></refsect2>
<refsect2 id="g-queue-pop-nth-link" role="function" condition="since:2.4">
<title>g_queue_pop_nth_link&#160;()</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 language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_pop_nth_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                      <parameter><link linkend="guint"><type>guint</type></link> n</parameter>);</programlisting>
<para>Removes and returns the link at the given position.</para>
<refsect3 id="g-queue-pop-nth-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n</para></entry>
<entry role="parameter_description"><para>the link's position</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-pop-nth-link.returns" role="returns">
<title>Returns</title>
<para> 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>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-peek-head-link" role="function" condition="since:2.4">
<title>g_queue_peek_head_link&#160;()</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 language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_peek_head_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Returns the first link in <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-peek-head-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-peek-head-link.returns" role="returns">
<title>Returns</title>
<para> the first link in <parameter>queue</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>queue</parameter>
is empty</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-peek-tail-link" role="function" condition="since:2.4">
<title>g_queue_peek_tail_link&#160;()</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 language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_peek_tail_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>);</programlisting>
<para>Returns the last link in <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-peek-tail-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-peek-tail-link.returns" role="returns">
<title>Returns</title>
<para> the last link in <parameter>queue</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> if <parameter>queue</parameter>
is empty</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-peek-nth-link" role="function" condition="since:2.4">
<title>g_queue_peek_nth_link&#160;()</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 language="C"><link linkend="GList"><returnvalue>GList</returnvalue></link>&#160;*
g_queue_peek_nth_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                       <parameter><link linkend="guint"><type>guint</type></link> n</parameter>);</programlisting>
<para>Returns the link at the given position</para>
<refsect3 id="g-queue-peek-nth-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n</para></entry>
<entry role="parameter_description"><para>the position of the link</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-peek-nth-link.returns" role="returns">
<title>Returns</title>
<para> 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</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-link-index" role="function" condition="since:2.4">
<title>g_queue_link_index&#160;()</title>
<indexterm zone="g-queue-link-index" role="2.4"><primary sortas="queue_link_index">g_queue_link_index</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_queue_link_index (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                    <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</programlisting>
<para>Returns the position of <parameter>link_</parameter>
 in <parameter>queue</parameter>
.</para>
<refsect3 id="g-queue-link-index.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-queue-link-index.returns" role="returns">
<title>Returns</title>
<para> the position of <parameter>link_</parameter>
, or -1 if the link is
not part of <parameter>queue</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-unlink" role="function" condition="since:2.4">
<title>g_queue_unlink&#160;()</title>
<indexterm zone="g-queue-unlink" role="2.4"><primary sortas="queue_unlink">g_queue_unlink</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_unlink (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</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>
<refsect3 id="g-queue-unlink.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link that must be part of <parameter>queue</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>
<refsect2 id="g-queue-delete-link" role="function" condition="since:2.4">
<title>g_queue_delete_link&#160;()</title>
<indexterm zone="g-queue-delete-link" role="2.4"><primary sortas="queue_delete_link">g_queue_delete_link</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_queue_delete_link (<parameter><link linkend="GQueue"><type>GQueue</type></link> *queue</parameter>,
                     <parameter><link linkend="GList"><type>GList</type></link> *link_</parameter>);</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>
<refsect3 id="g-queue-delete-link.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>queue</para></entry>
<entry role="parameter_description"><para>a <link linkend="GQueue"><type>GQueue</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>link_</para></entry>
<entry role="parameter_description"><para>a <link linkend="GList"><type>GList</type></link> link that must be part of <parameter>queue</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.4">2.4</link></para></refsect2>

</refsect1>
<refsect1 id="glib-Double-ended-Queues.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GQueue" role="struct">
<title>struct GQueue</title>
<indexterm zone="GQueue"><primary sortas="Queue">GQueue</primary></indexterm>
<programlisting language="C">struct GQueue {
  GList *head;
  GList *tail;
  guint  length;
};
</programlisting>
<para>Contains the public fields of a
<link linkend="glib-Double-ended-Queues">Queue</link>.</para>
<refsect3 id="GQueue.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="GList"><type>GList</type></link>&#160;*<structfield id="GQueue.head">head</structfield>;</para></entry>
<entry role="struct_member_description"><para>a pointer to the first element of the queue</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="GList"><type>GList</type></link>&#160;*<structfield id="GQueue.tail">tail</structfield>;</para></entry>
<entry role="struct_member_description"><para>a pointer to the last element of the queue</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><link linkend="guint"><type>guint</type></link>&#160;<structfield id="GQueue.length">length</structfield>;</para></entry>
<entry role="struct_member_description"><para>the number of elements in the queue</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</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 language="C">#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 role="example"><![CDATA[
GQueue my_queue = G_QUEUE_INIT;
]]></programlisting></informalexample>
<para></para>
<para role="since">Since: <link linkend="api-index-2.14">2.14</link></para></refsect2>

</refsect1>

</refentry>
