<refentry id="camel-camel-list-utils">
<refmeta>
<refentrytitle role="top_of_page" id="camel-camel-list-utils.top_of_page">camel-list-utils</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>camel-list-utils</refname>
<refpurpose></refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="camel-camel-list-utils.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="CamelDList">CamelDList</link>;
                    <link linkend="CamelDListNode">CamelDListNode</link>;
#define             <link linkend="CAMEL-DLIST-INITIALISER:CAPS">CAMEL_DLIST_INITIALISER</link>             (l)
<link linkend="void">void</link>                <link linkend="camel-dlist-init">camel_dlist_init</link>                    (<link linkend="CamelDList">CamelDList</link> *v);
<link linkend="CamelDListNode">CamelDListNode</link>*     <link linkend="camel-dlist-addhead">camel_dlist_addhead</link>                 (<link linkend="CamelDList">CamelDList</link> *l,
                                                         <link linkend="CamelDListNode">CamelDListNode</link> *n);
<link linkend="CamelDListNode">CamelDListNode</link>*     <link linkend="camel-dlist-addtail">camel_dlist_addtail</link>                 (<link linkend="CamelDList">CamelDList</link> *l,
                                                         <link linkend="CamelDListNode">CamelDListNode</link> *n);
<link linkend="CamelDListNode">CamelDListNode</link>*     <link linkend="camel-dlist-remove">camel_dlist_remove</link>                  (<link linkend="CamelDListNode">CamelDListNode</link> *n);
<link linkend="CamelDListNode">CamelDListNode</link>*     <link linkend="camel-dlist-remhead">camel_dlist_remhead</link>                 (<link linkend="CamelDList">CamelDList</link> *l);
<link linkend="CamelDListNode">CamelDListNode</link>*     <link linkend="camel-dlist-remtail">camel_dlist_remtail</link>                 (<link linkend="CamelDList">CamelDList</link> *l);
<link linkend="int">int</link>                 <link linkend="camel-dlist-empty">camel_dlist_empty</link>                   (<link linkend="CamelDList">CamelDList</link> *l);
<link linkend="int">int</link>                 <link linkend="camel-dlist-length">camel_dlist_length</link>                  (<link linkend="CamelDList">CamelDList</link> *l);
                    <link linkend="CamelSListNode">CamelSListNode</link>;
                    <link linkend="CamelSList">CamelSList</link>;
#define             <link linkend="CAMEL-SLIST-INITIALISER:CAPS">CAMEL_SLIST_INITIALISER</link>             (l)
<link linkend="void">void</link>                <link linkend="camel-slist-init">camel_slist_init</link>                    (<link linkend="CamelSList">CamelSList</link> *l);
<link linkend="CamelSListNode">CamelSListNode</link>*     <link linkend="camel-slist-addhead">camel_slist_addhead</link>                 (<link linkend="CamelSList">CamelSList</link> *l,
                                                         <link linkend="CamelSListNode">CamelSListNode</link> *n);
<link linkend="CamelSListNode">CamelSListNode</link>*     <link linkend="camel-slist-addtail">camel_slist_addtail</link>                 (<link linkend="CamelSList">CamelSList</link> *l,
                                                         <link linkend="CamelSListNode">CamelSListNode</link> *n);
<link linkend="CamelSListNode">CamelSListNode</link>*     <link linkend="camel-slist-remove">camel_slist_remove</link>                  (<link linkend="CamelSList">CamelSList</link> *l,
                                                         <link linkend="CamelSListNode">CamelSListNode</link> *n);
<link linkend="CamelSListNode">CamelSListNode</link>*     <link linkend="camel-slist-remhead">camel_slist_remhead</link>                 (<link linkend="CamelSList">CamelSList</link> *l);
<link linkend="CamelSListNode">CamelSListNode</link>*     <link linkend="camel-slist-remtail">camel_slist_remtail</link>                 (<link linkend="CamelSList">CamelSList</link> *l);
<link linkend="int">int</link>                 <link linkend="camel-slist-empty">camel_slist_empty</link>                   (<link linkend="CamelSList">CamelSList</link> *l);
<link linkend="int">int</link>                 <link linkend="camel-slist-length">camel_slist_length</link>                  (<link linkend="CamelSList">CamelSList</link> *l);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-camel-list-utils.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="camel-camel-list-utils.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelDList" role="struct">
<title>CamelDList</title>
<indexterm zone="CamelDList"><primary>CamelDList</primary></indexterm><programlisting>typedef struct {
	struct _CamelDListNode *head;
	struct _CamelDListNode *tail;
	struct _CamelDListNode *tailpred;
} CamelDList;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelDListNode" role="struct">
<title>CamelDListNode</title>
<indexterm zone="CamelDListNode"><primary>CamelDListNode</primary></indexterm><programlisting>typedef struct {
	struct _CamelDListNode *next;
	struct _CamelDListNode *prev;
} CamelDListNode;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CAMEL-DLIST-INITIALISER:CAPS" role="macro">
<title>CAMEL_DLIST_INITIALISER()</title>
<indexterm zone="CAMEL-DLIST-INITIALISER:CAPS"><primary>CAMEL_DLIST_INITIALISER</primary></indexterm><programlisting>#define CAMEL_DLIST_INITIALISER(l) { (CamelDListNode *)&amp;l.tail, 0, (CamelDListNode *)&amp;l.head }
</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-init" role="function">
<title>camel_dlist_init ()</title>
<indexterm zone="camel-dlist-init"><primary>camel_dlist_init</primary></indexterm><programlisting><link linkend="void">void</link>                camel_dlist_init                    (<link linkend="CamelDList">CamelDList</link> *v);</programlisting>
<para>
Initialise a double-linked list header.  All list headers must be
initialised before use.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>v</parameter>&nbsp;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-addhead" role="function">
<title>camel_dlist_addhead ()</title>
<indexterm zone="camel-dlist-addhead"><primary>camel_dlist_addhead</primary></indexterm><programlisting><link linkend="CamelDListNode">CamelDListNode</link>*     camel_dlist_addhead                 (<link linkend="CamelDList">CamelDList</link> *l,
                                                         <link linkend="CamelDListNode">CamelDListNode</link> *n);</programlisting>
<para>
Add the list node <parameter>n</parameter> to the head (start) of the list <parameter>l</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara> An initialised list header.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara> A node, the next and prev pointers will be overwritten.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <parameter>n</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-addtail" role="function">
<title>camel_dlist_addtail ()</title>
<indexterm zone="camel-dlist-addtail"><primary>camel_dlist_addtail</primary></indexterm><programlisting><link linkend="CamelDListNode">CamelDListNode</link>*     camel_dlist_addtail                 (<link linkend="CamelDList">CamelDList</link> *l,
                                                         <link linkend="CamelDListNode">CamelDListNode</link> *n);</programlisting>
<para>
Add the list onde <parameter>n</parameter> to the tail (end) of the list <parameter>l</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara> An intialised list header.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara> A node, the next and prev pointers will be overwritten.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <parameter>n</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-remove" role="function">
<title>camel_dlist_remove ()</title>
<indexterm zone="camel-dlist-remove"><primary>camel_dlist_remove</primary></indexterm><programlisting><link linkend="CamelDListNode">CamelDListNode</link>*     camel_dlist_remove                  (<link linkend="CamelDListNode">CamelDListNode</link> *n);</programlisting>
<para>
Remove <parameter>n</parameter> from the list it's in.  <parameter>n</parameter> must belong to a list.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara> A node which is part of a list.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <parameter>n</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-remhead" role="function">
<title>camel_dlist_remhead ()</title>
<indexterm zone="camel-dlist-remhead"><primary>camel_dlist_remhead</primary></indexterm><programlisting><link linkend="CamelDListNode">CamelDListNode</link>*     camel_dlist_remhead                 (<link linkend="CamelDList">CamelDList</link> *l);</programlisting>
<para>
Remove the head node (start) of the list.
</para>
<para>
xReturn value: The previously first-node in the list, or NULLif <parameter>l</parameter>
is an empty list.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara> An initialised list, maybe containing items.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-remtail" role="function">
<title>camel_dlist_remtail ()</title>
<indexterm zone="camel-dlist-remtail"><primary>camel_dlist_remtail</primary></indexterm><programlisting><link linkend="CamelDListNode">CamelDListNode</link>*     camel_dlist_remtail                 (<link linkend="CamelDList">CamelDList</link> *l);</programlisting>
<para>
Remove the last node in the list.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara> An initialised list, maybe containing items.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The previously last-node in the list, or NULL if <parameter>l</parameter>
is an empty list.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-empty" role="function">
<title>camel_dlist_empty ()</title>
<indexterm zone="camel-dlist-empty"><primary>camel_dlist_empty</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_dlist_empty                   (<link linkend="CamelDList">CamelDList</link> *l);</programlisting>
<para>
Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>l</parameter> is an empty list.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara> An initialised list header.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>l</parameter> is an empty list, <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-dlist-length" role="function">
<title>camel_dlist_length ()</title>
<indexterm zone="camel-dlist-length"><primary>camel_dlist_length</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_dlist_length                  (<link linkend="CamelDList">CamelDList</link> *l);</programlisting>
<para>
Returns the number of nodes in the list <parameter>l</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara> An initialised list header.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The number of nodes.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="CamelSListNode" role="struct">
<title>CamelSListNode</title>
<indexterm zone="CamelSListNode"><primary>CamelSListNode</primary></indexterm><programlisting>typedef struct {
	struct _CamelSListNode *next;
} CamelSListNode;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CamelSList" role="struct">
<title>CamelSList</title>
<indexterm zone="CamelSList"><primary>CamelSList</primary></indexterm><programlisting>typedef struct {
	struct _CamelSListNode *head;
} CamelSList;
</programlisting>
<para>

</para></refsect2>
<refsect2 id="CAMEL-SLIST-INITIALISER:CAPS" role="macro">
<title>CAMEL_SLIST_INITIALISER()</title>
<indexterm zone="CAMEL-SLIST-INITIALISER:CAPS"><primary>CAMEL_SLIST_INITIALISER</primary></indexterm><programlisting>#define CAMEL_SLIST_INITIALISER(l) { 0 }
</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-init" role="function">
<title>camel_slist_init ()</title>
<indexterm zone="camel-slist-init"><primary>camel_slist_init</primary></indexterm><programlisting><link linkend="void">void</link>                camel_slist_init                    (<link linkend="CamelSList">CamelSList</link> *l);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-addhead" role="function">
<title>camel_slist_addhead ()</title>
<indexterm zone="camel-slist-addhead"><primary>camel_slist_addhead</primary></indexterm><programlisting><link linkend="CamelSListNode">CamelSListNode</link>*     camel_slist_addhead                 (<link linkend="CamelSList">CamelSList</link> *l,
                                                         <link linkend="CamelSListNode">CamelSListNode</link> *n);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-addtail" role="function">
<title>camel_slist_addtail ()</title>
<indexterm zone="camel-slist-addtail"><primary>camel_slist_addtail</primary></indexterm><programlisting><link linkend="CamelSListNode">CamelSListNode</link>*     camel_slist_addtail                 (<link linkend="CamelSList">CamelSList</link> *l,
                                                         <link linkend="CamelSListNode">CamelSListNode</link> *n);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-remove" role="function">
<title>camel_slist_remove ()</title>
<indexterm zone="camel-slist-remove"><primary>camel_slist_remove</primary></indexterm><programlisting><link linkend="CamelSListNode">CamelSListNode</link>*     camel_slist_remove                  (<link linkend="CamelSList">CamelSList</link> *l,
                                                         <link linkend="CamelSListNode">CamelSListNode</link> *n);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>n</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-remhead" role="function">
<title>camel_slist_remhead ()</title>
<indexterm zone="camel-slist-remhead"><primary>camel_slist_remhead</primary></indexterm><programlisting><link linkend="CamelSListNode">CamelSListNode</link>*     camel_slist_remhead                 (<link linkend="CamelSList">CamelSList</link> *l);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-remtail" role="function">
<title>camel_slist_remtail ()</title>
<indexterm zone="camel-slist-remtail"><primary>camel_slist_remtail</primary></indexterm><programlisting><link linkend="CamelSListNode">CamelSListNode</link>*     camel_slist_remtail                 (<link linkend="CamelSList">CamelSList</link> *l);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-empty" role="function">
<title>camel_slist_empty ()</title>
<indexterm zone="camel-slist-empty"><primary>camel_slist_empty</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_slist_empty                   (<link linkend="CamelSList">CamelSList</link> *l);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-slist-length" role="function">
<title>camel_slist_length ()</title>
<indexterm zone="camel-slist-length"><primary>camel_slist_length</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_slist_length                  (<link linkend="CamelSList">CamelSList</link> *l);</programlisting>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>l</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>


</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
