glib-Hash-Tables.html   [plain text]


<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hash Tables</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.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="previous" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="next" href="glib-Strings.html" title="Strings"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="refentry" href="glib-building.html" title="Compiling the GLib package"><link rel="refentry" href="glib-cross-compiling.html" title="Cross-compiling the GLib package"><link rel="refentry" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="refentry" href="glib-running.html" title="Running GLib Applications"><link rel="refentry" href="glib-changes.html" title="Changes to GLib"><link rel="refentry" href="glib-resources.html" title="Mailing lists and bug reports"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="refentry" href="glib-Basic-Types.html" title="Basic Types"><link rel="refentry" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="refentry" href="glib-Standard-Macros.html" title="Standard Macros"><link rel="refentry" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><link rel="refentry" href="glib-Byte-Order-Macros.html" title="Byte Order Macros"><link rel="refentry" href="glib-Numerical-Definitions.html" title="Numerical Definitions"><link rel="refentry" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros"><link rel="refentry" href="glib-Atomic-Operations.html" title="Atomic Operations"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="refentry" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop"><link rel="refentry" href="glib-Threads.html" title="
Threads"><link rel="refentry" href="glib-Thread-Pools.html" title="Thread Pools"><link rel="refentry" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues"><link rel="refentry" href="glib-Dynamic-Loading-of-Modules.html" title="Dynamic Loading of Modules"><link rel="refentry" href="glib-Memory-Allocation.html" title="Memory Allocation"><link rel="refentry" href="glib-IO-Channels.html" title="IO Channels"><link rel="refentry" href="glib-Error-Reporting.html" title="Error Reporting"><link rel="refentry" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><link rel="refentry" href="glib-Message-Logging.html" title="Message Logging"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="refentry" href="glib-String-Utility-Functions.html" title="String Utility Functions"><link rel="refentry" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"><link rel="refentry" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation"><link rel="refentry" href="glib-I18N.html" title="Internationalization"><link rel="refentry" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions"><link rel="refentry" href="glib-Random-Numbers.html" title="Random Numbers"><link rel="refentry" href="glib-Hook-Functions.html" title="Hook Functions"><link rel="refentry" href="glib-Miscellaneous-Utility-Functions.html" title="Miscellaneous Utility Functions"><link rel="refentry" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="refentry" href="glib-Automatic-String-Completion.html" title="Automatic String Completion"><link rel="refentry" href="glib-Timers.html" title="Timers"><link rel="refentry" href="glib-Spawning-Processes.html" title="Spawning Processes"><link rel="refentry" href="glib-File-Utilities.html" title="File Utilities"><link rel="refentry" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities"><link rel="refentry" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="refentry" href="glib-Simple-XML-Subset-Parser.html" title="Simple XML Subset Parser"><link rel="refentry" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="refentry" href="glib-Memory-Chunks.html" title="Memory Chunks"><link rel="refentry" href="glib-Doubly-Linked-Lists.html" title="Doubly-Linked Lists"><link rel="refentry" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists"><link rel="refentry" href="glib-Double-ended-Queues.html" title="Double-ended Queues"><link rel="refentry" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="refentry" href="glib-Hash-Tables.html" title="Hash Tables"><link rel="refentry" href="glib-Strings.html" title="Strings"><link rel="refentry" href="glib-String-Chunks.html" title="String Chunks"><link rel="refentry" href="glib-Arrays.html" title="Arrays"><link rel="refentry" href="glib-Pointer-Arrays.html" title="Pointer Arrays"><link rel="refentry" href="glib-Byte-Arrays.html" title="Byte Arrays"><link rel="refentry" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="refentry" href="glib-N-ary-Trees.html" title="N-ary Trees"><link rel="refentry" href="glib-Quarks.html" title="Quarks"><link rel="refentry" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists"><link rel="refentry" href="glib-Datasets.html" title="Datasets"><link rel="refentry" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="refentry" href="glib-Caches.html" title="Caches"><link rel="refentry" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="refentry" href="glib-gettextize.html" title="glib-gettextize"><link rel="index" href="ix01.html" title="Index"><link rel="section" href="glib-Hash-Tables.html#id3269393" title="Description"><link rel="section" href="glib-Hash-Tables.html#id3269603" title="Details"><meta name="generator" content="GTK-Doc V1.2 (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" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Trash-Stacks.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-Strings.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-Hash-Tables"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">Hash Tables</span></h2><p>Hash Tables &#8212; associations between keys and values so that given a key the value
can be found quickly.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">

#include &lt;glib.h&gt;


struct      <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);
void        <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);
void        <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);
void        <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);
void        (<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);
<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)
void        <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-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> v,
                                             <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> v,
                                             <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> v,
                                             <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="id3269393"></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"><tt class="function">g_strdup()</tt></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"><tt class="function">g_hash_table_new()</tt></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"><tt class="function">g_hash_table_insert()</tt></a>.
</p><p>
To lookup a value corresponding to a given key, use <a href="glib-Hash-Tables.html#g-hash-table-lookup"><tt class="function">g_hash_table_lookup()</tt></a>
and <a href="glib-Hash-Tables.html#g-hash-table-lookup-extended"><tt class="function">g_hash_table_lookup_extended()</tt></a>.
</p><p>
To remove a key and value, use <a href="glib-Hash-Tables.html#g-hash-table-remove"><tt class="function">g_hash_table_remove()</tt></a>.
</p><p>
To call a function for each key and value pair use <a href="glib-Hash-Tables.html#g-hash-table-foreach"><tt class="function">g_hash_table_foreach()</tt></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"><tt class="function">g_hash_table_destroy()</tt></a>.
</p></div><div class="refsect1" lang="en"><a name="id3269603"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3269609"></a><h3><a name="GHashTable"></a>struct GHashTable</h3><a class="indexterm" name="id3269619"></a><pre class="programlisting">struct 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="id3269648"></a><h3><a name="g-hash-table-new"></a>g_hash_table_new ()</h3><a class="indexterm" name="id3269659"></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>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>hash_func</tt></i> :</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"><tt class="function">g_direct_hash()</tt></a>, <a href="glib-Hash-Tables.html#g-int-hash"><tt class="function">g_int_hash()</tt></a> and 
  <a href="glib-Hash-Tables.html#g-str-hash"><tt class="function">g_str_hash()</tt></a> functions are provided for some common types of keys. 
  If hash_func is <tt class="literal">NULL</tt>, <a href="glib-Hash-Tables.html#g-direct-hash"><tt class="function">g_direct_hash()</tt></a> is used.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key_equal_func</tt></i> :</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"><tt class="function">g_direct_equal()</tt></a>,
  <a href="glib-Hash-Tables.html#g-int-equal"><tt class="function">g_int_equal()</tt></a> and <a href="glib-Hash-Tables.html#g-str-equal"><tt class="function">g_str_equal()</tt></a> functions are provided for the most
  common types of keys. If <i class="parameter"><tt>key_equal_func</tt></i> is <tt class="literal">NULL</tt>, keys are compared
  directly in a similar fashion to <a href="glib-Hash-Tables.html#g-direct-equal"><tt class="function">g_direct_equal()</tt></a>, but without the
  overhead of a function call.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</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="id3269881"></a><h3><a name="g-hash-table-new-full"></a>g_hash_table_new_full ()</h3><a class="indexterm" name="id3269892"></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"><tt class="function">g_hash_table_new()</tt></a> 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"><i class="parameter"><tt>hash_func</tt></i> :</span></td><td> a function to create a hash value from a key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key_equal_func</tt></i> :</span></td><td> a function to check two keys for equality.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key_destroy_func</tt></i> :</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 <tt class="literal">NULL</tt> if you 
  don't want to supply such a function.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value_destroy_func</tt></i> :</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 <tt class="literal">NULL</tt> if 
  you don't want to supply such a function.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</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="id3270088"></a><h3><a name="GHashFunc"></a>GHashFunc ()</h3><a class="indexterm" name="id3270098"></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"><tt class="function">g_hash_table_new()</tt></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"><tt class="function">g_direct_hash()</tt></a>, <a href="glib-Hash-Tables.html#g-int-hash"><tt class="function">g_int_hash()</tt></a> and <a href="glib-Hash-Tables.html#g-str-hash"><tt class="function">g_str_hash()</tt></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"><i class="parameter"><tt>key</tt></i> :</span></td><td>a key.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the hash value corresponding to the key.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3270251"></a><h3><a name="GEqualFunc"></a>GEqualFunc ()</h3><a class="indexterm" name="id3270261"></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 <tt class="literal">TRUE</tt> if both values are equal and
<tt class="literal">FALSE</tt> otherwise.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>a</tt></i> :</span></td><td>a value.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>b</tt></i> :</span></td><td>a value to compare with.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if <i class="parameter"><tt>a</tt></i> = <i class="parameter"><tt>b</tt></i>; <tt class="literal">FALSE</tt> otherwise.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3270375"></a><h3><a name="g-hash-table-insert"></a>g_hash_table_insert ()</h3><a class="indexterm" name="id3270386"></a><pre class="programlisting">void        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 <i class="parameter"><tt>value_destroy_func</tt></i> 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 <i class="parameter"><tt>key_destroy_func</tt></i> 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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td> a key to insert.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</span></td><td> the value to associate with the key.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3270538"></a><h3><a name="g-hash-table-replace"></a>g_hash_table_replace ()</h3><a class="indexterm" name="id3270549"></a><pre class="programlisting">void        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"><tt class="function">g_hash_table_insert()</tt></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 
<i class="parameter"><tt>value_destroy_func</tt></i> 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 <i class="parameter"><tt>key_destroy_func</tt></i> 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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td> a key to insert.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</span></td><td> the value to associate with the key.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3270709"></a><h3><a name="g-hash-table-size"></a>g_hash_table_size ()</h3><a class="indexterm" name="id3270720"></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"><i class="parameter"><tt>hash_table</tt></i> :</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> :</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="id3270803"></a><h3><a name="g-hash-table-lookup"></a>g_hash_table_lookup ()</h3><a class="indexterm" name="id3270814"></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>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td> the key to look up.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the associated value, or <tt class="literal">NULL</tt> if the key is not found.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3270918"></a><h3><a name="g-hash-table-lookup-extended"></a>g_hash_table_lookup_extended ()</h3><a class="indexterm" name="id3270929"></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 <tt class="literal">TRUE</tt> 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"><tt class="function">g_hash_table_remove()</tt></a>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>lookup_key</tt></i> :</span></td><td> the key to look up.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>orig_key</tt></i> :</span></td><td> returns the original key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</span></td><td> returns the value associated with the key.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> 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="id3271112"></a><h3><a name="g-hash-table-foreach"></a>g_hash_table_foreach ()</h3><a class="indexterm" name="id3271124"></a><pre class="programlisting">void        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 <i class="parameter"><tt>user_data</tt></i> 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-remove"><tt class="function">g_hash_table_remove()</tt></a>.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</span></td><td> the function to call for each key/value pair.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td> user data to pass to the function.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3271254"></a><h3><a name="g-hash-table-find"></a>g_hash_table_find ()</h3><a class="indexterm" name="id3271266"></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 
<i class="parameter"><tt>predicate</tt></i> returns <tt class="literal">TRUE</tt>.  The function is passed the key and value of 
each pair, and the given <i class="parameter"><tt>user_data</tt></i> 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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>predicate</tt></i> :</span></td><td>  function to test the key/value pairs for a certain property.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td>  user data to pass to the function.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The value of the first key/value pair is returned, for which 
func evaluates to <tt class="literal">TRUE</tt>. If no pair with the requested property is found, 
<tt class="literal">NULL</tt> is returned.

</td></tr></tbody></table></div><p>Since  2.4
</p></div><hr><div class="refsect2" lang="en"><a name="id3271425"></a><h3><a name="GHFunc"></a>GHFunc ()</h3><a class="indexterm" name="id3271436"></a><pre class="programlisting">void        (*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"><tt class="function">g_hash_table_foreach()</tt></a>.
It is called with each key/value pair, together with the <i class="parameter"><tt>user_data</tt></i> parameter
which is passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach"><tt class="function">g_hash_table_foreach()</tt></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td>a key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</span></td><td>the value corresponding to the key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td>user data passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach"><tt class="function">g_hash_table_foreach()</tt></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3271566"></a><h3><a name="g-hash-table-remove"></a>g_hash_table_remove ()</h3><a class="indexterm" name="id3271577"></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"><tt class="function">g_hash_table_new_full()</tt></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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td> the key to remove.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> 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="id3271714"></a><h3><a name="g-hash-table-steal"></a>g_hash_table_steal ()</h3><a class="indexterm" name="id3271725"></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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td> the key to remove.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <tt class="literal">TRUE</tt> 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="id3271837"></a><h3><a name="g-hash-table-foreach-remove"></a>g_hash_table_foreach_remove ()</h3><a class="indexterm" name="id3271849"></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 <tt class="literal">TRUE</tt>, 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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</span></td><td> the function to call for each key/value pair.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td> user data to pass to the function.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the number of key/value pairs removed.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3271994"></a><h3><a name="g-hash-table-foreach-steal"></a>g_hash_table_foreach_steal ()</h3><a class="indexterm" name="id3272006"></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 <tt class="literal">TRUE</tt>, 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"><i class="parameter"><tt>hash_table</tt></i> :</span></td><td> a <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</span></td><td> the function to call for each key/value pair.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td> user data to pass to the function.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the number of key/value pairs removed.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3272142"></a><h3><a name="GHRFunc"></a>GHRFunc ()</h3><a class="indexterm" name="id3272152"></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"><tt class="function">g_hash_table_foreach_remove()</tt></a>.
It is called with each key/value pair, together with the <i class="parameter"><tt>user_data</tt></i> parameter
passed to <a href="glib-Hash-Tables.html#g-hash-table-foreach-remove"><tt class="function">g_hash_table_foreach_remove()</tt></a>.
It should return <tt class="literal">TRUE</tt> 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"><i class="parameter"><tt>key</tt></i> :</span></td><td>a key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</span></td><td>the value associated with the key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_data</tt></i> :</span></td><td>user data passed to <a href="glib-Hash-Tables.html#g-hash-table-remove"><tt class="function">g_hash_table_remove()</tt></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> 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="id3272321"></a><h3><a name="g-hash-table-freeze"></a>g_hash_table_freeze()</h3><a class="indexterm" name="id3272332"></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><tt class="literal">g_hash_table_freeze</tt> 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"><i class="parameter"><tt>hash_table</tt></i> :</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="id3272387"></a><h3><a name="g-hash-table-thaw"></a>g_hash_table_thaw()</h3><a class="indexterm" name="id3272397"></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><tt class="literal">g_hash_table_thaw</tt> 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"><i class="parameter"><tt>hash_table</tt></i> :</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="id3272453"></a><h3><a name="g-hash-table-destroy"></a>g_hash_table_destroy ()</h3><a class="indexterm" name="id3272464"></a><pre class="programlisting">void        g_hash_table_destroy            (<a href="glib-Hash-Tables.html#GHashTable">GHashTable</a> *hash_table);</pre><p>
Destroys the <a href="glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>. 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>
using <a href="glib-Hash-Tables.html#g-hash-table-new-full"><tt class="function">g_hash_table_new_full()</tt></a>. In the latter case the destroy functions 
you supplied will be called on all keys and values before destroying 
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"><i class="parameter"><tt>hash_table</tt></i> :</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="id3272560"></a><h3><a name="g-direct-equal"></a>g_direct_equal ()</h3><a class="indexterm" name="id3272570"></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> v,
                                             <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 <tt class="literal">TRUE</tt> if they are equal.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><tt class="function">g_hash_table_new()</tt></a> as the <i class="parameter"><tt>key_equal_func</tt></i>
parameter, when using pointers as keys in a <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"><i class="parameter"><tt>v</tt></i> :</span></td><td>a key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>v2</tt></i> :</span></td><td>a key to compare with <i class="parameter"><tt>v</tt></i>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if the two keys match.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3272700"></a><h3><a name="g-direct-hash"></a>g_direct_hash ()</h3><a class="indexterm" name="id3272711"></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"><tt class="function">g_hash_table_new()</tt></a> as the <i class="parameter"><tt>hash_func</tt></i> parameter, when
using pointers as keys in a <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"><i class="parameter"><tt>v</tt></i> :</span></td><td>a gpointer key.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a hash value corresponding to the key.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3272794"></a><h3><a name="g-int-equal"></a>g_int_equal ()</h3><a class="indexterm" name="id3272804"></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> v,
                                             <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 <tt class="literal">TRUE</tt> if they are
equal.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><tt class="function">g_hash_table_new()</tt></a> as the <i class="parameter"><tt>key_equal_func</tt></i>
parameter, when using pointers to integers as keys in a <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"><i class="parameter"><tt>v</tt></i> :</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"><i class="parameter"><tt>v2</tt></i> :</span></td><td>a pointer to a <a href="glib-Basic-Types.html#gint"><span class="type">gint</span></a> key to compare with <i class="parameter"><tt>v</tt></i>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if the two keys match.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3272949"></a><h3><a name="g-int-hash"></a>g_int_hash ()</h3><a class="indexterm" name="id3272960"></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"><tt class="function">g_hash_table_new()</tt></a> as the <i class="parameter"><tt>hash_func</tt></i> 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><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>v</tt></i> :</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> :</span></td><td>a hash value corresponding to the key.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3273059"></a><h3><a name="g-str-equal"></a>g_str_equal ()</h3><a class="indexterm" name="id3273070"></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> v,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> v2);</pre><p>
Compares two strings and returns <tt class="literal">TRUE</tt> if they are equal.
It can be passed to <a href="glib-Hash-Tables.html#g-hash-table-new"><tt class="function">g_hash_table_new()</tt></a> as the <i class="parameter"><tt>key_equal_func</tt></i>
parameter, when using strings as keys in a <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"><i class="parameter"><tt>v</tt></i> :</span></td><td>a key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>v2</tt></i> :</span></td><td>a key to compare with <i class="parameter"><tt>v</tt></i>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if the two keys match.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3273190"></a><h3><a name="g-str-hash"></a>g_str_hash ()</h3><a class="indexterm" name="id3273201"></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"><tt class="function">g_hash_table_new()</tt></a> as the <i class="parameter"><tt>hash_func</tt></i> parameter, when
using strings as keys in a <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"><i class="parameter"><tt>v</tt></i> :</span></td><td>a string key.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a hash value corresponding to the key.


</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Trash-Stacks.html"><b>&lt;&lt; Trash Stacks</b></a></td><td align="right"><a accesskey="n" href="glib-Strings.html"><b>Strings &gt;&gt;</b></a></td></tr></table></body></html>