design work for librarygo

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Hash Tables</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-data-types.html" title="GLib Data Types">
<link rel="prev" href="glib-Trash-Stacks.html" title="Trash Stacks">
<link rel="next" href="glib-Strings.html" title="Strings">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>

<body alink="#0000ff" bgcolor="white" link="#0000ff" text="black" vlink="#840084">

<div id="gnomegeneralbar">
  <ul>
    <li><a href="http://www.gnome.org/" class="wgolink"><img src="http://www.gnome.org/img/logo/text-64.png"></a></li>
    <li>News</li>
    <li>Projects</li>
    <li>Art</li>
    <li>Support</li>
    <li>Development</li>
    <li>Foundation</li>
    <!-- arg! I can't get this to look right.
    But the gnome web project will be designing a new global gnome bar
    this is just a placeholder. it should be fairly pretty and functional
    -->
  </ul>
</div>
<div id="librarygnomeorgbar">
  Gnome Library
<div class="spacer"></div>

</div>

<div class="refentry" lang="en">
<a name="glib-Hash-Tables"></a>

<!-- title & synopsis -->
  <h1>Hash Tables</h1>
  <p class="articlesynopsis">Hash Tables — associations between keys and values so that given a key the value
can be found quickly.</p>

<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;


            <a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>;
<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>* <a href="glib-Hash-Tables.html#g-hash-table-new">g_hash_table_new</a>                (<a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_func,
                                             <a href="glib-Hash-Tables.html#GEqualFunc">GEqualFunc</a> key_equal_func);
<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>* <a href="glib-Hash-Tables.html#g-hash-table-new-full">g_hash_table_new_full</a>           (<a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_func,
                                             <a href="glib-Hash-Tables.html#GEqualFunc">GEqualFunc</a> key_equal_func,
                                             <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> key_destroy_func,
                                             <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> value_destroy_func);
<a href="glib-Basic-Types.html#guint">guint</a>       (<a href="glib-Hash-Tables.html#GHashFunc">*GHashFunc</a>)                    (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    (<a href="glib-Hash-Tables.html#GEqualFunc">*GEqualFunc</a>)                   (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> a,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> b);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-insert">g_hash_table_insert</a>             (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-replace">g_hash_table_replace</a>            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Hash-Tables.html#g-hash-table-size">g_hash_table_size</a>               (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);
<a href="glib-Basic-Types.html#gpointer">gpointer</a>    <a href="glib-Hash-Tables.html#g-hash-table-lookup">g_hash_table_lookup</a>             (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Hash-Tables.html#g-hash-table-lookup-extended">g_hash_table_lookup_extended</a>    (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> lookup_key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> *orig_key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> *value);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-foreach">g_hash_table_foreach</a>            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHFunc">GHFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<a href="glib-Basic-Types.html#gpointer">gpointer</a>    <a href="glib-Hash-Tables.html#g-hash-table-find">g_hash_table_find</a>               (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHRFunc">GHRFunc</a> predicate,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        (<a href="glib-Hash-Tables.html#GHFunc">*GHFunc</a>)                       (<a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Hash-Tables.html#g-hash-table-remove">g_hash_table_remove</a>             (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Hash-Tables.html#g-hash-table-steal">g_hash_table_steal</a>              (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Hash-Tables.html#g-hash-table-foreach-remove">g_hash_table_foreach_remove</a>     (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHRFunc">GHRFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Hash-Tables.html#g-hash-table-foreach-steal">g_hash_table_foreach_steal</a>      (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHRFunc">GHRFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-remove-all">g_hash_table_remove_all</a>         (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-steal-all">g_hash_table_steal_all</a>          (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    (<a href="glib-Hash-Tables.html#GHRFunc">*GHRFunc</a>)                      (<a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
#define     <a href="glib-Hash-Tables.html#g-hash-table-freeze">g_hash_table_freeze</a>             (hash_table)
#define     <a href="glib-Hash-Tables.html#g-hash-table-thaw">g_hash_table_thaw</a>               (hash_table)
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-destroy">g_hash_table_destroy</a>            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);
<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>* <a href="glib-Hash-Tables.html#g-hash-table-ref">g_hash_table_ref</a>                (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);
<GTKDOCLINK HREF="void">void</GTKDOCLINK>        <a href="glib-Hash-Tables.html#g-hash-table-unref">g_hash_table_unref</a>              (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);

<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Hash-Tables.html#g-direct-equal">g_direct_equal</a>                  (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v1,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Hash-Tables.html#g-direct-hash">g_direct_hash</a>                   (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Hash-Tables.html#g-int-equal">g_int_equal</a>                     (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v1,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Hash-Tables.html#g-int-hash">g_int_hash</a>                      (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-Hash-Tables.html#g-str-equal">g_str_equal</a>                     (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v1,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-Hash-Tables.html#g-str-hash">g_str_hash</a>                      (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3329863"></a><h2>Description</h2>
<p>
A <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> provides associations between keys and values which
is optimized so that given a key, the associated value can be found
very quickly.
</p>
<p>
Note that neither keys nor values are copied when inserted into the
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, so they must exist for the lifetime of the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
This means that the use of static strings is OK, but temporary
strings (i.e. those created in buffers and those returned by GTK+ widgets)
should be copied with <a href="glib-String-Utility-Functions.html#g-strdup"><code class="function">g_strdup()</code></a> before being inserted.
</p>
<p>
If keys or values are dynamically allocated, you must be careful to ensure
that they are freed when they are removed from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, and also
when they are overwritten by new insertions into the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
It is also not advisable to mix static strings and dynamically-allocated
strings in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, because it then becomes difficult to determine
whether the string should be freed.
</p>
<p>
To create a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, use <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a>.
</p>
<p>
To insert a key and value into a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, use <a href="glib-Hash-Tables.html#g-hash-table-insert"><code class="function">g_hash_table_insert()</code></a>.
</p>
<p>
To lookup a value corresponding to a given key, use <a href="glib-Hash-Tables.html#g-hash-table-lookup"><code class="function">g_hash_table_lookup()</code></a>
and <a href="glib-Hash-Tables.html#g-hash-table-lookup-extended"><code class="function">g_hash_table_lookup_extended()</code></a>.
</p>
<p>
To remove a key and value, use <a href="glib-Hash-Tables.html#g-hash-table-remove"><code class="function">g_hash_table_remove()</code></a>.
</p>
<p>
To call a function for each key and value pair use <a href="glib-Hash-Tables.html#g-hash-table-foreach"><code class="function">g_hash_table_foreach()</code></a>.
</p>
<p>
To destroy a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> use <a href="glib-Hash-Tables.html#g-hash-table-destroy"><code class="function">g_hash_table_destroy()</code></a>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3330077"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3330088"></a><h3>
<a name="GHashTable"></a>GHashTable</h3>
<a class="indexterm" name="id3330100"></a><pre class="programlisting">typedef struct _GHashTable GHashTable;</pre>
<p>
The <span class="structname">GHashTable</span> struct is an opaque data structure to represent a
<a href="glib-Hash-Tables.html" title="Hash Tables">Hash Table</a>.
It should only be accessed via the following functions.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3330129"></a><h3>
<a name="g-hash-table-new"></a>g_hash_table_new ()</h3>
<a class="indexterm" name="id3330142"></a><pre class="programlisting"><a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>* g_hash_table_new                (<a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_func,
                                             <a href="glib-Hash-Tables.html#GEqualFunc">GEqualFunc</a> key_equal_func);</pre>
<p>
Creates a new <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> with a reference count of 1.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_func</code></em>&#160;:</span></td>
<td> a function to create a hash value from a key.
  Hash values are used to determine where keys are stored within the
  <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> data structure. The <a href="glib-Hash-Tables.html#g-direct-hash"><code class="function">g_direct_hash()</code></a>, <a href="glib-Hash-Tables.html#g-int-hash"><code class="function">g_int_hash()</code></a> and 
  <a href="glib-Hash-Tables.html#g-str-hash"><code class="function">g_str_hash()</code></a> functions are provided for some common types of keys. 
  If hash_func is <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, <a href="glib-Hash-Tables.html#g-direct-hash"><code class="function">g_direct_hash()</code></a> is used.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key_equal_func</code></em>&#160;:</span></td>
<td> a function to check two keys for equality.  This is
  used when looking up keys in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.  The <a href="glib-Hash-Tables.html#g-direct-equal"><code class="function">g_direct_equal()</code></a>,
  <a href="glib-Hash-Tables.html#g-int-equal"><code class="function">g_int_equal()</code></a> and <a href="glib-Hash-Tables.html#g-str-equal"><code class="function">g_str_equal()</code></a> functions are provided for the most
  common types of keys. If <em class="parameter"><code>key_equal_func</code></em> is <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, keys are compared
  directly in a similar fashion to <a href="glib-Hash-Tables.html#g-direct-equal"><code class="function">g_direct_equal()</code></a>, but without the
  overhead of a function call.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3330373"></a><h3>
<a name="g-hash-table-new-full"></a>g_hash_table_new_full ()</h3>
<a class="indexterm" name="id3330386"></a><pre class="programlisting"><a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>* g_hash_table_new_full           (<a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_func,
                                             <a href="glib-Hash-Tables.html#GEqualFunc">GEqualFunc</a> key_equal_func,
                                             <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> key_destroy_func,
                                             <a href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> value_destroy_func);</pre>
<p>
Creates a new <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> like <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> with a reference count
of 1 and allows to specify functions to free the memory allocated for the
key and value that get called when removing the entry from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_func</code></em>&#160;:</span></td>
<td> a function to create a hash value from a key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key_equal_func</code></em>&#160;:</span></td>
<td> a function to check two keys for equality.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key_destroy_func</code></em>&#160;:</span></td>
<td> a function to free the memory allocated for the key 
  used when removing the entry from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if you 
  don't want to supply such a function.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>value_destroy_func</code></em>&#160;:</span></td>
<td> a function to free the memory allocated for the 
  value used when removing the entry from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if 
  you don't want to supply such a function.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3330591"></a><h3>
<a name="GHashFunc"></a>GHashFunc ()</h3>
<a class="indexterm" name="id3330603"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       (*GHashFunc)                    (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);</pre>
<p>
Specifies the type of the hash function which is passed to
<a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> when a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> is created.
</p>
<p>
The function is passed a key and should return a <a href="glib-Basic-Types.html#guint"><span class="type">guint</span></a> hash value.
The functions <a href="glib-Hash-Tables.html#g-direct-hash"><code class="function">g_direct_hash()</code></a>, <a href="glib-Hash-Tables.html#g-int-hash"><code class="function">g_int_hash()</code></a> and <a href="glib-Hash-Tables.html#g-str-hash"><code class="function">g_str_hash()</code></a> provide
hash functions which can be used when the key is a <a href="glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>, <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a>, and 
<a href="glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>* respectively.
</p>
<p>
FIXME: Need more here.
The hash values should be evenly distributed over a fairly large range?
The modulus is taken with the hash table size (a prime number)
to find the 'bucket' to place each key into.
The function should also be very fast, since it is called for each key
lookup.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td>a key.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>the hash value corresponding to the key.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3330756"></a><h3>
<a name="GEqualFunc"></a>GEqualFunc ()</h3>
<a class="indexterm" name="id3330768"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    (*GEqualFunc)                   (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> a,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> b);</pre>
<p>
Specifies the type of a function used to test two values for
equality. The function should return <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if both values are equal and
<a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>a</code></em>&#160;:</span></td>
<td>a value.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>b</code></em>&#160;:</span></td>
<td>a value to compare with.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>a</code></em> = <em class="parameter"><code>b</code></em>; <a href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3330900"></a><h3>
<a name="g-hash-table-insert"></a>g_hash_table_insert ()</h3>
<a class="indexterm" name="id3330913"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_insert             (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value);</pre>
<p>
Inserts a new key and value into a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</p>
<p>
If the key already exists in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> its current value is replaced
with the new value. If you supplied a <em class="parameter"><code>value_destroy_func</code></em> when creating the 
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, the old value is freed using that function. If you supplied
a <em class="parameter"><code>key_destroy_func</code></em> when creating the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, the passed key is freed 
using that function.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td> a key to insert.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td> the value to associate with the key.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3331065"></a><h3>
<a name="g-hash-table-replace"></a>g_hash_table_replace ()</h3>
<a class="indexterm" name="id3331078"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_replace            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value);</pre>
<p>
Inserts a new key and value into a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> similar to 
<a href="glib-Hash-Tables.html#g-hash-table-insert"><code class="function">g_hash_table_insert()</code></a>. The difference is that if the key already exists 
in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, it gets replaced by the new key. If you supplied a 
<em class="parameter"><code>value_destroy_func</code></em> when creating the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, the old value is freed 
using that function. If you supplied a <em class="parameter"><code>key_destroy_func</code></em> when creating the 
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, the old key is freed using that function.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td> a key to insert.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td> the value to associate with the key.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3331238"></a><h3>
<a name="g-hash-table-size"></a>g_hash_table_size ()</h3>
<a class="indexterm" name="id3331251"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_hash_table_size               (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre>
<p>
Returns the number of elements contained in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the number of key/value pairs in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3331334"></a><h3>
<a name="g-hash-table-lookup"></a>g_hash_table_lookup ()</h3>
<a class="indexterm" name="id3331347"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a>    g_hash_table_lookup             (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);</pre>
<p>
Looks up a key in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>. Note that this function cannot
distinguish between a key that is not present and one which is present
and has the value <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. If you need this distinction, use
<a href="glib-Hash-Tables.html#g-hash-table-lookup-extended"><code class="function">g_hash_table_lookup_extended()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td> the key to look up.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the associated value, or <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the key is not found.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3331479"></a><h3>
<a name="g-hash-table-lookup-extended"></a>g_hash_table_lookup_extended ()</h3>
<a class="indexterm" name="id3331492"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_hash_table_lookup_extended    (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> lookup_key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> *orig_key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> *value);</pre>
<p>
Looks up a key in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, returning the original key and the
associated value and a <a href="glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> which is <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key was found. This 
is useful if you need to free the memory allocated for the original key, 
for example before calling <a href="glib-Hash-Tables.html#g-hash-table-remove"><code class="function">g_hash_table_remove()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>lookup_key</code></em>&#160;:</span></td>
<td> the key to look up.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>orig_key</code></em>&#160;:</span></td>
<td> returns the original key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td> returns the value associated with the key.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key was found in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3331684"></a><h3>
<a name="g-hash-table-foreach"></a>g_hash_table_foreach ()</h3>
<a class="indexterm" name="id3331697"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_foreach            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHFunc">GHFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Calls the given function for each of the key/value pairs in the
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.  The function is passed the key and value of each
pair, and the given <em class="parameter"><code>user_data</code></em> parameter.  The hash table may not
be modified while iterating over it (you can't add/remove
items). To remove all items matching a predicate, use
<a href="glib-Hash-Tables.html#g-hash-table-foreach-remove"><code class="function">g_hash_table_foreach_remove()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></td>
<td> the function to call for each key/value pair.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to the function.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3331828"></a><h3>
<a name="g-hash-table-find"></a>g_hash_table_find ()</h3>
<a class="indexterm" name="id3331844"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a>    g_hash_table_find               (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHRFunc">GHRFunc</a> predicate,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Calls the given function for key/value pairs in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> until 
<em class="parameter"><code>predicate</code></em> returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.  The function is passed the key and value of 
each pair, and the given <em class="parameter"><code>user_data</code></em> parameter. The hash table may not
be modified while iterating over it (you can't add/remove items).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>predicate</code></em>&#160;:</span></td>
<td>  function to test the key/value pairs for a certain property.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td>  user data to pass to the function.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The value of the first key/value pair is returned, for which 
func evaluates to <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. If no pair with the requested property is found, 
<a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332016"></a><h3>
<a name="GHFunc"></a>GHFunc ()</h3>
<a class="indexterm" name="id3332029"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        (*GHFunc)                       (<a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Specifies the type of the function passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach"><code class="function">g_hash_table_foreach()</code></a>.
It is called with each key/value pair, together with the <em class="parameter"><code>user_data</code></em> parameter
which is passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach"><code class="function">g_hash_table_foreach()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td>a key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td>the value corresponding to the key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td>user data passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach"><code class="function">g_hash_table_foreach()</code></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332159"></a><h3>
<a name="g-hash-table-remove"></a>g_hash_table_remove ()</h3>
<a class="indexterm" name="id3332172"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_hash_table_remove             (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);</pre>
<p>
Removes a key and its associated value from a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</p>
<p>
If the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> was created using <a href="glib-Hash-Tables.html#g-hash-table-new-full"><code class="function">g_hash_table_new_full()</code></a>, the
key and value are freed using the supplied destroy functions, otherwise
you have to make sure that any dynamically allocated values are freed 
yourself.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td> the key to remove.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key was found and removed from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332313"></a><h3>
<a name="g-hash-table-steal"></a>g_hash_table_steal ()</h3>
<a class="indexterm" name="id3332326"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_hash_table_steal              (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key);</pre>
<p>
Removes a key and its associated value from a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> without
calling the key and value destroy functions.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td> the key to remove.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key was found and removed from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332442"></a><h3>
<a name="g-hash-table-foreach-remove"></a>g_hash_table_foreach_remove ()</h3>
<a class="indexterm" name="id3332456"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_hash_table_foreach_remove     (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHRFunc">GHRFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Calls the given function for each key/value pair in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
If the function returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then the key/value pair is removed from the
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>. If you supplied key or value destroy functions when creating
the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, they are used to free the memory allocated for the removed
keys and values.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></td>
<td> the function to call for each key/value pair.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to the function.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the number of key/value pairs removed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332606"></a><h3>
<a name="g-hash-table-foreach-steal"></a>g_hash_table_foreach_steal ()</h3>
<a class="indexterm" name="id3332620"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_hash_table_foreach_steal      (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table,
                                             <a href="glib-Hash-Tables.html#GHRFunc">GHRFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Calls the given function for each key/value pair in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
If the function returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, then the key/value pair is removed from the
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>, but no key or value destroy functions are called.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></td>
<td> the function to call for each key/value pair.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to the function.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the number of key/value pairs removed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332760"></a><h3>
<a name="g-hash-table-remove-all"></a>g_hash_table_remove_all ()</h3>
<a class="indexterm" name="id3332776"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_remove_all         (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre>
<p>
Removes all keys and their associated values from a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</p>
<p>
If the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> was created using <a href="glib-Hash-Tables.html#g-hash-table-new-full"><code class="function">g_hash_table_new_full()</code></a>, the keys
and values are freed using the supplied destroy functions, otherwise you
have to make sure that any dynamically allocated values are freed
yourself.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>
</td>
</tr></tbody>
</table></div>
<p>Since  2.12
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332871"></a><h3>
<a name="g-hash-table-steal-all"></a>g_hash_table_steal_all ()</h3>
<a class="indexterm" name="id3332886"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_steal_all          (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre>
<p>
Removes all keys and their associated values from a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> 
without calling the key and value destroy functions.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr></tbody>
</table></div>
<p>Since  2.12
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3332958"></a><h3>
<a name="GHRFunc"></a>GHRFunc ()</h3>
<a class="indexterm" name="id3332970"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    (*GHRFunc)                      (<a href="glib-Basic-Types.html#gpointer">gpointer</a> key,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> value,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Specifies the type of the function passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach-remove"><code class="function">g_hash_table_foreach_remove()</code></a>.
It is called with each key/value pair, together with the <em class="parameter"><code>user_data</code></em> parameter
passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach-remove"><code class="function">g_hash_table_foreach_remove()</code></a>.
It should return <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key/value pair should be removed from the
<a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td>
<td>a key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td>the value associated with the key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td>user data passed to <a href="glib-Hash-Tables.html#g-hash-table-remove"><code class="function">g_hash_table_remove()</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the key/value pair should be removed from the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333147"></a><h3>
<a name="g-hash-table-freeze"></a>g_hash_table_freeze()</h3>
<a class="indexterm" name="id3333162"></a><pre class="programlisting">#define     g_hash_table_freeze(hash_table)</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_hash_table_freeze</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
This function is deprecated and will be removed in the next major
 release of GLib. It does nothing.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td>a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333218"></a><h3>
<a name="g-hash-table-thaw"></a>g_hash_table_thaw()</h3>
<a class="indexterm" name="id3333232"></a><pre class="programlisting">#define     g_hash_table_thaw(hash_table)</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_hash_table_thaw</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
This function is deprecated and will be removed in the next major
 release of GLib. It does nothing.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td>a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333288"></a><h3>
<a name="g-hash-table-destroy"></a>g_hash_table_destroy ()</h3>
<a class="indexterm" name="id3333300"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_destroy            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre>
<p>
Destroys all keys and values in the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> and decrements its
reference count by 1. If keys and/or values are dynamically allocated,
you should either free them first or create the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> with destroy
notifiers using <a href="glib-Hash-Tables.html#g-hash-table-new-full"><code class="function">g_hash_table_new_full()</code></a>. In the latter case the destroy
functions you supplied will be called on all keys and values during the
destruction phase.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333390"></a><h3>
<a name="g-hash-table-ref"></a>g_hash_table_ref ()</h3>
<a class="indexterm" name="id3333405"></a><pre class="programlisting"><a href="glib-Hash-Tables.html#GHashTable">GHashTable</a>* g_hash_table_ref                (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre>
<p>
Atomically increments the reference count of <em class="parameter"><code>hash_table</code></em> by one.
This function is MT-safe and may be called from any thread.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a valid <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the passed in <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.10
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333493"></a><h3>
<a name="g-hash-table-unref"></a>g_hash_table_unref ()</h3>
<a class="indexterm" name="id3333508"></a><pre class="programlisting"><GTKDOCLINK HREF="void">void</GTKDOCLINK>        g_hash_table_unref              (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre>
<p>
Atomically decrements the reference count of <em class="parameter"><code>hash_table</code></em> by one.
If the reference count drops to 0, all keys and values will be
destroyed, and all memory allocated by the hash table is released.
This function is MT-safe and may be called from any thread.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>hash_table</code></em>&#160;:</span></td>
<td> a valid <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td>
</tr></tbody>
</table></div>
<p>Since  2.10
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333580"></a><h3>
<a name="g-direct-equal"></a>g_direct_equal ()</h3>
<a class="indexterm" name="id3333593"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_direct_equal                  (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v1,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);</pre>
<p>
Compares two <a href="glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> arguments and returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if they are equal.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
parameter, when using pointers as keys in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>v1</code></em>&#160;:</span></td>
<td> a key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>v2</code></em>&#160;:</span></td>
<td> a key to compare with <em class="parameter"><code>v1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the two keys match.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333736"></a><h3>
<a name="g-direct-hash"></a>g_direct_hash ()</h3>
<a class="indexterm" name="id3333749"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_direct_hash                   (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v);</pre>
<p>
Converts a gpointer to a hash value.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
when using pointers as keys in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>v</code></em>&#160;:</span></td>
<td> a <a href="glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> key
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a hash value corresponding to the key.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3333843"></a><h3>
<a name="g-int-equal"></a>g_int_equal ()</h3>
<a class="indexterm" name="id3333855"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_int_equal                     (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v1,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);</pre>
<p>
Compares the two <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a> values being pointed to and returns 
<a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if they are equal.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
parameter, when using pointers to integers as keys in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>v1</code></em>&#160;:</span></td>
<td> a pointer to a <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a> key.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>v2</code></em>&#160;:</span></td>
<td> a pointer to a <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a> key to compare with <em class="parameter"><code>v1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the two keys match.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3334014"></a><h3>
<a name="g-int-hash"></a>g_int_hash ()</h3>
<a class="indexterm" name="id3334026"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_int_hash                      (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v);</pre>
<p>
Converts a pointer to a <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a> to a hash value.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
when using pointers to integers values as keys in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>v</code></em>&#160;:</span></td>
<td> a pointer to a <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a> key
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a hash value corresponding to the key.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3334129"></a><h3>
<a name="g-str-equal"></a>g_str_equal ()</h3>
<a class="indexterm" name="id3334141"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_str_equal                     (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v1,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);</pre>
<p>
Compares two strings and returns <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if they are equal.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>key_equal_func</code></em>
parameter, when using strings as keys in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>v1</code></em>&#160;:</span></td>
<td> a key. 
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>v2</code></em>&#160;:</span></td>
<td> a key to compare with <em class="parameter"><code>v1</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the two keys match.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3334275"></a><h3>
<a name="g-str-hash"></a>g_str_hash ()</h3>
<a class="indexterm" name="id3334288"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_str_hash                      (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v);</pre>
<p>
Converts a string to a hash value.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><code class="function">g_hash_table_new()</code></a> as the <em class="parameter"><code>hash_func</code></em> parameter, 
when using strings as keys in a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>v</code></em>&#160;:</span></td>
<td> a string key.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a hash value corresponding to the key.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>

/* styles for library.gnome.org */
body {
  margin:0;
}

/* header --------------------- */
/* common GNOME.org navigation bar */
div#gnomegeneralbar {
  background: #444;
  color: white;
}

div#gnomegeneralbar img {
  border:none;
  }
  
div#gnomegeneralbar .wgolink  {
 float:left; 
}

div#gnomegeneralbar ul {
        list-style-type:none;
        margin:0;
        padding:0;
}
div#gnomegeneralbar li {
  display:inline;
  padding:1em 1em;
        margin:0px; /* opera! */
        border-right:1px white solid;
}

/* library header */
div#librarygnomeorgbar {
  color: #fce94f;
  background:#5c3566;
  padding:0.5em 1em;
  text-align:right;
  font-size:1.2em;
  font-weight:bold;
}

div.spacer {
  clear:both;
}

/* ----------------------------- */
div.refentry { /* wrapper for the entire documentation article */
  padding: 0.5em;
}

#articlesynopsis {
}


.synopsis, .classsynopsis 
{
  background: #eeeeee;
  border: solid 1px #aaaaaa;
  padding: 0.5em;
}
.programlisting 
{
  background: #eeeeff;
  border: solid 1px #aaaaff;
  padding: 0.5em;
}
.variablelist 
{
  padding: 4px;
  margin-left: 3em;
}
.variablelist td:first-child
{
  vertical-align: top;
}
div a[name]
{
  position: relative;
  top: -4.5em;
}
div.refentry, div.chapter, div.part, div.book, div.index, div.glossary, div.sect1
{
  position: relative;
  top: 3em;
  z-index: 0;
}
div.refnamediv 
{
  margin-top: 2em;
}
div.gallery-float 
{
  float: left;
  padding: 10px;
}
div.gallery-float img 
{
  border-style: none;
}
div.gallery-spacer 
{
  clear: both;
}
a
{
  text-decoration: none;
}
a:hover
{
  text-decoration: underline;
  color: #FF0000;
}

JoachimNoreiko/Library (last edited 2008-02-03 14:46:49 by anonymous)