blob: 528a287e799fb6a11cb73da2f11754c8de72914c [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Double-ended Queues: GLib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
<link rel="prev" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists">
<link rel="next" href="glib-Sequences.html" title="Sequences">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#glib-Double-ended-Queues.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="glib-Singly-Linked-Lists.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="glib-Sequences.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-Double-ended-Queues"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Double-ended-Queues.top_of_page"></a>Double-ended Queues</span></h2>
<p>Double-ended Queues — double-ended queue data structure</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="glib-Double-ended-Queues.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="returnvalue">GQueue</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-new" title="g_queue_new ()">g_queue_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-free" title="g_queue_free ()">g_queue_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-free-full" title="g_queue_free_full ()">g_queue_free_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-init" title="g_queue_init ()">g_queue_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-clear" title="g_queue_clear ()">g_queue_clear</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-is-empty" title="g_queue_is_empty ()">g_queue_is_empty</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-get-length" title="g_queue_get_length ()">g_queue_get_length</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-reverse" title="g_queue_reverse ()">g_queue_reverse</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="returnvalue">GQueue</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-copy" title="g_queue_copy ()">g_queue_copy</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-foreach" title="g_queue_foreach ()">g_queue_foreach</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-find" title="g_queue_find ()">g_queue_find</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-find-custom" title="g_queue_find_custom ()">g_queue_find_custom</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-sort" title="g_queue_sort ()">g_queue_sort</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-head" title="g_queue_push_head ()">g_queue_push_head</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-tail" title="g_queue_push_tail ()">g_queue_push_tail</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-nth" title="g_queue_push_nth ()">g_queue_push_nth</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-head" title="g_queue_pop_head ()">g_queue_pop_head</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-tail" title="g_queue_pop_tail ()">g_queue_pop_tail</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-nth" title="g_queue_pop_nth ()">g_queue_pop_nth</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-peek-head" title="g_queue_peek_head ()">g_queue_peek_head</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-peek-tail" title="g_queue_peek_tail ()">g_queue_peek_tail</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-peek-nth" title="g_queue_peek_nth ()">g_queue_peek_nth</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-index" title="g_queue_index ()">g_queue_index</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-remove" title="g_queue_remove ()">g_queue_remove</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-remove-all" title="g_queue_remove_all ()">g_queue_remove_all</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-insert-before" title="g_queue_insert_before ()">g_queue_insert_before</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-insert-after" title="g_queue_insert_after ()">g_queue_insert_after</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-insert-sorted" title="g_queue_insert_sorted ()">g_queue_insert_sorted</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-head-link" title="g_queue_push_head_link ()">g_queue_push_head_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-tail-link" title="g_queue_push_tail_link ()">g_queue_push_tail_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-nth-link" title="g_queue_push_nth_link ()">g_queue_push_nth_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-head-link" title="g_queue_pop_head_link ()">g_queue_pop_head_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-tail-link" title="g_queue_pop_tail_link ()">g_queue_pop_tail_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-nth-link" title="g_queue_pop_nth_link ()">g_queue_pop_nth_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-peek-head-link" title="g_queue_peek_head_link ()">g_queue_peek_head_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-peek-tail-link" title="g_queue_peek_tail_link ()">g_queue_peek_tail_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-peek-nth-link" title="g_queue_peek_nth_link ()">g_queue_peek_nth_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-link-index" title="g_queue_link_index ()">g_queue_link_index</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-unlink" title="g_queue_unlink ()">g_queue_unlink</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Double-ended-Queues.html#g-queue-delete-link" title="g_queue_delete_link ()">g_queue_delete_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-Double-ended-Queues.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue">GQueue</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Double-ended-Queues.html#G-QUEUE-INIT:CAPS" title="G_QUEUE_INIT">G_QUEUE_INIT</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-Double-ended-Queues.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glib.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="glib-Double-ended-Queues.description"></a><h2>Description</h2>
<p>The <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> structure and its associated functions provide a standard
queue data structure. Internally, GQueue uses the same data structure
as <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> to store elements.</p>
<p>The data contained in each element can be either integer values, by
using one of the <a class="link" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros">Type Conversion Macros</a>,
or simply pointers to any type of data.</p>
<p>To create a new GQueue, use <a class="link" href="glib-Double-ended-Queues.html#g-queue-new" title="g_queue_new ()"><code class="function">g_queue_new()</code></a>.</p>
<p>To initialize a statically-allocated GQueue, use <a class="link" href="glib-Double-ended-Queues.html#G-QUEUE-INIT:CAPS" title="G_QUEUE_INIT"><span class="type">G_QUEUE_INIT</span></a> or
<a class="link" href="glib-Double-ended-Queues.html#g-queue-init" title="g_queue_init ()"><code class="function">g_queue_init()</code></a>.</p>
<p>To add elements, use <a class="link" href="glib-Double-ended-Queues.html#g-queue-push-head" title="g_queue_push_head ()"><code class="function">g_queue_push_head()</code></a>, <a class="link" href="glib-Double-ended-Queues.html#g-queue-push-head-link" title="g_queue_push_head_link ()"><code class="function">g_queue_push_head_link()</code></a>,
<a class="link" href="glib-Double-ended-Queues.html#g-queue-push-tail" title="g_queue_push_tail ()"><code class="function">g_queue_push_tail()</code></a> and <a class="link" href="glib-Double-ended-Queues.html#g-queue-push-tail-link" title="g_queue_push_tail_link ()"><code class="function">g_queue_push_tail_link()</code></a>.</p>
<p>To remove elements, use <a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-head" title="g_queue_pop_head ()"><code class="function">g_queue_pop_head()</code></a> and <a class="link" href="glib-Double-ended-Queues.html#g-queue-pop-tail" title="g_queue_pop_tail ()"><code class="function">g_queue_pop_tail()</code></a>.</p>
<p>To free the entire queue, use <a class="link" href="glib-Double-ended-Queues.html#g-queue-free" title="g_queue_free ()"><code class="function">g_queue_free()</code></a>.</p>
</div>
<div class="refsect1">
<a name="glib-Double-ended-Queues.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-queue-new"></a><h3>g_queue_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="returnvalue">GQueue</span></a> *
g_queue_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a>.</p>
<div class="refsect3">
<a name="g-queue-new.returns"></a><h4>Returns</h4>
<p> a newly allocated <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-free"></a><h3>g_queue_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_free (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Frees the memory allocated for the <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a>. Only call this function
if <em class="parameter"><code>queue</code></em>
was created with <a class="link" href="glib-Double-ended-Queues.html#g-queue-new" title="g_queue_new ()"><code class="function">g_queue_new()</code></a>. If queue elements contain
dynamically-allocated memory, they should be freed first.</p>
<p>If queue elements contain dynamically-allocated memory, you should
either use <a class="link" href="glib-Double-ended-Queues.html#g-queue-free-full" title="g_queue_free_full ()"><code class="function">g_queue_free_full()</code></a> or free them manually first.</p>
<div class="refsect3">
<a name="g-queue-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-free-full"></a><h3>g_queue_free_full ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_free_full (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> free_func</code></em>);</pre>
<p>Convenience method, which frees all the memory used by a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a>,
and calls the specified destroy function on every element's data.</p>
<div class="refsect3">
<a name="g-queue-free-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a pointer to a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>free_func</p></td>
<td class="parameter_description"><p>the function to be called to free each element's data</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-init"></a><h3>g_queue_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_init (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>A statically-allocated <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> must be initialized with this function
before it can be used. Alternatively you can initialize it with
<a class="link" href="glib-Double-ended-Queues.html#G-QUEUE-INIT:CAPS" title="G_QUEUE_INIT"><span class="type">G_QUEUE_INIT</span></a>. It is not necessary to initialize queues created with
<a class="link" href="glib-Double-ended-Queues.html#g-queue-new" title="g_queue_new ()"><code class="function">g_queue_new()</code></a>.</p>
<div class="refsect3">
<a name="g-queue-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>an uninitialized <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-clear"></a><h3>g_queue_clear ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_clear (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Removes all the elements in <em class="parameter"><code>queue</code></em>
. If queue elements contain
dynamically-allocated memory, they should be freed first.</p>
<div class="refsect3">
<a name="g-queue-clear.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-is-empty"></a><h3>g_queue_is_empty ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_queue_is_empty (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the queue is empty.</p>
<div class="refsect3">
<a name="g-queue-is-empty.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-is-empty.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-get-length"></a><h3>g_queue_get_length ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
g_queue_get_length (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Returns the number of items in <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-get-length.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-get-length.returns"></a><h4>Returns</h4>
<p> the number of items in <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-reverse"></a><h3>g_queue_reverse ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_reverse (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Reverses the order of the items in <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-reverse.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-copy"></a><h3>g_queue_copy ()</h3>
<pre class="programlisting"><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="returnvalue">GQueue</span></a> *
g_queue_copy (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Copies a <em class="parameter"><code>queue</code></em>
. 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.</p>
<div class="refsect3">
<a name="g-queue-copy.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-copy.returns"></a><h4>Returns</h4>
<p> a copy of <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-foreach"></a><h3>g_queue_foreach ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_foreach (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GFunc" title="GFunc ()"><span class="type">GFunc</span></a> func</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Calls <em class="parameter"><code>func</code></em>
for each element in the queue passing <em class="parameter"><code>user_data</code></em>
to the
function.</p>
<div class="refsect3">
<a name="g-queue-foreach.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>the function to call for each element's data</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data to pass to <em class="parameter"><code>func</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-find"></a><h3>g_queue_find ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_find (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> data</code></em>);</pre>
<p>Finds the first link in <em class="parameter"><code>queue</code></em>
which contains <em class="parameter"><code>data</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-find.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>data to find</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-find.returns"></a><h4>Returns</h4>
<p> the first link in <em class="parameter"><code>queue</code></em>
which contains <em class="parameter"><code>data</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-find-custom"></a><h3>g_queue_find_custom ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_find_custom (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> data</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GCompareFunc" title="GCompareFunc ()"><span class="type">GCompareFunc</span></a> func</code></em>);</pre>
<p>Finds an element in a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a>, 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 <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> element's data as the
first argument and the given user data as the second argument.</p>
<div class="refsect3">
<a name="g-queue-find-custom.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>user data passed to <em class="parameter"><code>func</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareFunc" title="GCompareFunc ()"><span class="type">GCompareFunc</span></a> to call for each element. It should return 0
when the desired element is found</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-find-custom.returns"></a><h4>Returns</h4>
<p> the found link, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if it wasn't found</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-sort"></a><h3>g_queue_sort ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_sort (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()"><span class="type">GCompareDataFunc</span></a> compare_func</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Sorts <em class="parameter"><code>queue</code></em>
using <em class="parameter"><code>compare_func</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-sort.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>compare_func</p></td>
<td class="parameter_description"><p>the <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()"><span class="type">GCompareDataFunc</span></a> used to sort <em class="parameter"><code>queue</code></em>
. 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.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data passed to <em class="parameter"><code>compare_func</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-push-head"></a><h3>g_queue_push_head ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_push_head (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Adds a new element at the head of the queue.</p>
<div class="refsect3">
<a name="g-queue-push-head.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data for the new element.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-push-tail"></a><h3>g_queue_push_tail ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_push_tail (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Adds a new element at the tail of the queue.</p>
<div class="refsect3">
<a name="g-queue-push-tail.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data for the new element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-push-nth"></a><h3>g_queue_push_nth ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_push_nth (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> n</code></em>);</pre>
<p>Inserts a new element into <em class="parameter"><code>queue</code></em>
at the given position.</p>
<div class="refsect3">
<a name="g-queue-push-nth.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data for the new element</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the position to insert the new element. If <em class="parameter"><code>n</code></em>
is negative or
larger than the number of elements in the <em class="parameter"><code>queue</code></em>
, the element is
added to the end of the queue.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-pop-head"></a><h3>g_queue_pop_head ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_queue_pop_head (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Removes the first element of the queue and returns its data.</p>
<div class="refsect3">
<a name="g-queue-pop-head.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-pop-head.returns"></a><h4>Returns</h4>
<p> the data of the first element in the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-pop-tail"></a><h3>g_queue_pop_tail ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_queue_pop_tail (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Removes the last element of the queue and returns its data.</p>
<div class="refsect3">
<a name="g-queue-pop-tail.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-pop-tail.returns"></a><h4>Returns</h4>
<p> the data of the last element in the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-pop-nth"></a><h3>g_queue_pop_nth ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_queue_pop_nth (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> n</code></em>);</pre>
<p>Removes the <em class="parameter"><code>n</code></em>
'th element of <em class="parameter"><code>queue</code></em>
and returns its data.</p>
<div class="refsect3">
<a name="g-queue-pop-nth.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the position of the element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-pop-nth.returns"></a><h4>Returns</h4>
<p> the element's data, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>n</code></em>
is off the end of <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-peek-head"></a><h3>g_queue_peek_head ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_queue_peek_head (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Returns the first element of the queue.</p>
<div class="refsect3">
<a name="g-queue-peek-head.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-peek-head.returns"></a><h4>Returns</h4>
<p> the data of the first element in the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-peek-tail"></a><h3>g_queue_peek_tail ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_queue_peek_tail (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Returns the last element of the queue.</p>
<div class="refsect3">
<a name="g-queue-peek-tail.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-peek-tail.returns"></a><h4>Returns</h4>
<p> the data of the last element in the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-peek-nth"></a><h3>g_queue_peek_nth ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_queue_peek_nth (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> n</code></em>);</pre>
<p>Returns the <em class="parameter"><code>n</code></em>
'th element of <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-peek-nth.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the position of the element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-peek-nth.returns"></a><h4>Returns</h4>
<p> the data for the <em class="parameter"><code>n</code></em>
'th element of <em class="parameter"><code>queue</code></em>
,
or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>n</code></em>
is off the end of <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-index"></a><h3>g_queue_index ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_queue_index (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> data</code></em>);</pre>
<p>Returns the position of the first element in <em class="parameter"><code>queue</code></em>
which contains <em class="parameter"><code>data</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-index.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to find</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-index.returns"></a><h4>Returns</h4>
<p> the position of the first element in <em class="parameter"><code>queue</code></em>
which
contains <em class="parameter"><code>data</code></em>
, or -1 if no element in <em class="parameter"><code>queue</code></em>
contains <em class="parameter"><code>data</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-remove"></a><h3>g_queue_remove ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_queue_remove (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> data</code></em>);</pre>
<p>Removes the first element in <em class="parameter"><code>queue</code></em>
that contains <em class="parameter"><code>data</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-remove.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to remove</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-remove.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>data</code></em>
was found and removed from <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-remove-all"></a><h3>g_queue_remove_all ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
g_queue_remove_all (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> data</code></em>);</pre>
<p>Remove all elements whose data equals <em class="parameter"><code>data</code></em>
from <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-remove-all.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to remove</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-remove-all.returns"></a><h4>Returns</h4>
<p> the number of elements removed from <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-insert-before"></a><h3>g_queue_insert_before ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_insert_before (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *sibling</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Inserts <em class="parameter"><code>data</code></em>
into <em class="parameter"><code>queue</code></em>
before <em class="parameter"><code>sibling</code></em>
.</p>
<p><em class="parameter"><code>sibling</code></em>
must be part of <em class="parameter"><code>queue</code></em>
. Since GLib 2.44 a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> sibling pushes the
data at the tail of the queue.</p>
<div class="refsect3">
<a name="g-queue-insert-before.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>sibling</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> link that must be part of <em class="parameter"><code>queue</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to
push at the tail of the queue. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to insert</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-insert-after"></a><h3>g_queue_insert_after ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_insert_after (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *sibling</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>);</pre>
<p>Inserts <em class="parameter"><code>data</code></em>
into <em class="parameter"><code>queue</code></em>
after <em class="parameter"><code>sibling</code></em>
.</p>
<p><em class="parameter"><code>sibling</code></em>
must be part of <em class="parameter"><code>queue</code></em>
. Since GLib 2.44 a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> sibling pushes the
data at the head of the queue.</p>
<div class="refsect3">
<a name="g-queue-insert-after.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>sibling</p></td>
<td class="parameter_description"><p> a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> link that must be part of <em class="parameter"><code>queue</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to
push at the head of the queue. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to insert</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-insert-sorted"></a><h3>g_queue_insert_sorted ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_insert_sorted (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()"><span class="type">GCompareDataFunc</span></a> func</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Inserts <em class="parameter"><code>data</code></em>
into <em class="parameter"><code>queue</code></em>
using <em class="parameter"><code>func</code></em>
to determine the new position.</p>
<div class="refsect3">
<a name="g-queue-insert-sorted.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to insert</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>the <a class="link" href="glib-Doubly-Linked-Lists.html#GCompareDataFunc" title="GCompareDataFunc ()"><span class="type">GCompareDataFunc</span></a> used to compare elements in the queue. It is
called with two elements of the <em class="parameter"><code>queue</code></em>
and <em class="parameter"><code>user_data</code></em>
. 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.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data passed to <em class="parameter"><code>func</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-push-head-link"></a><h3>g_queue_push_head_link ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_push_head_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *link_</code></em>);</pre>
<p>Adds a new element at the head of the queue.</p>
<div class="refsect3">
<a name="g-queue-push-head-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>link_</p></td>
<td class="parameter_description"><p>a single <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> element, not a list with more than one element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-push-tail-link"></a><h3>g_queue_push_tail_link ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_push_tail_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *link_</code></em>);</pre>
<p>Adds a new element at the tail of the queue.</p>
<div class="refsect3">
<a name="g-queue-push-tail-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>link_</p></td>
<td class="parameter_description"><p>a single <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> element, not a list with more than one element</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-push-nth-link"></a><h3>g_queue_push_nth_link ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_push_nth_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="type">gint</span></a> n</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *link_</code></em>);</pre>
<p>Inserts <em class="parameter"><code>link</code></em>
into <em class="parameter"><code>queue</code></em>
at the given position.</p>
<div class="refsect3">
<a name="g-queue-push-nth-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the position to insert the link. If this is negative or larger than
the number of elements in <em class="parameter"><code>queue</code></em>
, the link is added to the end of
<em class="parameter"><code>queue</code></em>
.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>link_</p></td>
<td class="parameter_description"><p>the link to add to <em class="parameter"><code>queue</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-pop-head-link"></a><h3>g_queue_pop_head_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_pop_head_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Removes and returns the first element of the queue.</p>
<div class="refsect3">
<a name="g-queue-pop-head-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-pop-head-link.returns"></a><h4>Returns</h4>
<p> the <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> element at the head of the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-pop-tail-link"></a><h3>g_queue_pop_tail_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_pop_tail_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Removes and returns the last element of the queue.</p>
<div class="refsect3">
<a name="g-queue-pop-tail-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-pop-tail-link.returns"></a><h4>Returns</h4>
<p> the <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> element at the tail of the queue, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if the queue is empty</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-pop-nth-link"></a><h3>g_queue_pop_nth_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_pop_nth_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> n</code></em>);</pre>
<p>Removes and returns the link at the given position.</p>
<div class="refsect3">
<a name="g-queue-pop-nth-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the link's position</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-pop-nth-link.returns"></a><h4>Returns</h4>
<p> the <em class="parameter"><code>n</code></em>
'th link, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>n</code></em>
is off the end of <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-peek-head-link"></a><h3>g_queue_peek_head_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_peek_head_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Returns the first link in <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-peek-head-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-peek-head-link.returns"></a><h4>Returns</h4>
<p> the first link in <em class="parameter"><code>queue</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>queue</code></em>
is empty</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-peek-tail-link"></a><h3>g_queue_peek_tail_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_peek_tail_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>);</pre>
<p>Returns the last link in <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-peek-tail-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-peek-tail-link.returns"></a><h4>Returns</h4>
<p> the last link in <em class="parameter"><code>queue</code></em>
, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>queue</code></em>
is empty</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-peek-nth-link"></a><h3>g_queue_peek_nth_link ()</h3>
<pre class="programlisting"><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="returnvalue">GList</span></a> *
g_queue_peek_nth_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> n</code></em>);</pre>
<p>Returns the link at the given position</p>
<div class="refsect3">
<a name="g-queue-peek-nth-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>n</p></td>
<td class="parameter_description"><p>the position of the link</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-peek-nth-link.returns"></a><h4>Returns</h4>
<p> the link at the <em class="parameter"><code>n</code></em>
'th position, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
if <em class="parameter"><code>n</code></em>
is off the end of the list</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-link-index"></a><h3>g_queue_link_index ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint ()"><span class="returnvalue">gint</span></a>
g_queue_link_index (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *link_</code></em>);</pre>
<p>Returns the position of <em class="parameter"><code>link_</code></em>
in <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-link-index.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>link_</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> link</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-queue-link-index.returns"></a><h4>Returns</h4>
<p> the position of <em class="parameter"><code>link_</code></em>
, or -1 if the link is
not part of <em class="parameter"><code>queue</code></em>
</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-unlink"></a><h3>g_queue_unlink ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_unlink (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *link_</code></em>);</pre>
<p>Unlinks <em class="parameter"><code>link_</code></em>
so that it will no longer be part of <em class="parameter"><code>queue</code></em>
.
The link is not freed.</p>
<p><em class="parameter"><code>link_</code></em>
must be part of <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-unlink.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>link_</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> link that must be part of <em class="parameter"><code>queue</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-queue-delete-link"></a><h3>g_queue_delete_link ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_queue_delete_link (<em class="parameter"><code><a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> *queue</code></em>,
<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *link_</code></em>);</pre>
<p>Removes <em class="parameter"><code>link_</code></em>
from <em class="parameter"><code>queue</code></em>
and frees it.</p>
<p><em class="parameter"><code>link_</code></em>
must be part of <em class="parameter"><code>queue</code></em>
.</p>
<div class="refsect3">
<a name="g-queue-delete-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>queue</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>link_</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> link that must be part of <em class="parameter"><code>queue</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p>
</div>
</div>
<div class="refsect1">
<a name="glib-Double-ended-Queues.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GQueue"></a><h3>struct GQueue</h3>
<pre class="programlisting">struct GQueue {
GList *head;
GList *tail;
guint length;
};
</pre>
<p>Contains the public fields of a
<a class="link" href="glib-Double-ended-Queues.html" title="Double-ended Queues">Queue</a>.</p>
<div class="refsect3">
<a name="GQueue.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *<em class="structfield"><code><a name="GQueue.head"></a>head</code></em>;</p></td>
<td class="struct_member_description"><p>a pointer to the first element of the queue</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="glib-Doubly-Linked-Lists.html#GList" title="struct GList"><span class="type">GList</span></a> *<em class="structfield"><code><a name="GQueue.tail"></a>tail</code></em>;</p></td>
<td class="struct_member_description"><p>a pointer to the last element of the queue</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> <em class="structfield"><code><a name="GQueue.length"></a>length</code></em>;</p></td>
<td class="struct_member_description"><p>the number of elements in the queue</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="G-QUEUE-INIT:CAPS"></a><h3>G_QUEUE_INIT</h3>
<pre class="programlisting">#define G_QUEUE_INIT { NULL, NULL, 0 }
</pre>
<p>A statically-allocated <a class="link" href="glib-Double-ended-Queues.html#GQueue" title="struct GQueue"><span class="type">GQueue</span></a> 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 <a class="link" href="glib-Double-ended-Queues.html#g-queue-init" title="g_queue_init ()"><code class="function">g_queue_init()</code></a>.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">GQueue</span><span class="normal"> my_queue </span><span class="symbol">=</span><span class="normal"> <a href="glib-Double-ended-Queues.html#G-QUEUE-INIT:CAPS">G_QUEUE_INIT</a></span><span class="symbol">;</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>