Add g_hash_table_{remove,steal}_all to remove all nodes from a hash table.
[platform/upstream/glib.git] / glib / ghash.h
index f85522a..41813de 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef __G_HASH_H__
 #define __G_HASH_H__
 
-#include <gtypes.h>
+#include <glib/gtypes.h>
 
 G_BEGIN_DECLS
 
@@ -54,8 +54,10 @@ void        g_hash_table_replace           (GHashTable     *hash_table,
                                            gpointer        value);
 gboolean    g_hash_table_remove                   (GHashTable     *hash_table,
                                            gconstpointer   key);
+void        g_hash_table_remove_all        (GHashTable     *hash_table);
 gboolean    g_hash_table_steal             (GHashTable     *hash_table,
                                            gconstpointer   key);
+void        g_hash_table_steal_all         (GHashTable     *hash_table);
 gpointer    g_hash_table_lookup                   (GHashTable     *hash_table,
                                            gconstpointer   key);
 gboolean    g_hash_table_lookup_extended   (GHashTable    *hash_table,
@@ -65,6 +67,9 @@ gboolean    g_hash_table_lookup_extended   (GHashTable           *hash_table,
 void       g_hash_table_foreach           (GHashTable     *hash_table,
                                            GHFunc          func,
                                            gpointer        user_data);
+gpointer    g_hash_table_find             (GHashTable     *hash_table,
+                                           GHRFunc         predicate,
+                                           gpointer        user_data);
 guint      g_hash_table_foreach_remove    (GHashTable     *hash_table,
                                            GHRFunc         func,
                                            gpointer        user_data);
@@ -73,29 +78,37 @@ guint           g_hash_table_foreach_steal     (GHashTable     *hash_table,
                                            gpointer        user_data);
 guint      g_hash_table_size              (GHashTable     *hash_table);
 
+/* keeping hash tables alive */
+GHashTable* g_hash_table_ref                      (GHashTable     *hash_table);
+void        g_hash_table_unref             (GHashTable     *hash_table);
+
+#ifndef G_DISABLE_DEPRECATED
+
 /* The following two functions are deprecated and will be removed in
  * the next major release. They do no good. */
-void       g_hash_table_freeze            (GHashTable     *hash_table);
-void       g_hash_table_thaw              (GHashTable     *hash_table);
+#define g_hash_table_freeze(hash_table) ((void)0)
+#define g_hash_table_thaw(hash_table) ((void)0)
+
+#endif /* G_DISABLE_DEPRECATED */
 
 /* Hash Functions
  */
-gboolean g_str_equal (gconstpointer  v,
+gboolean g_str_equal (gconstpointer  v1,
                       gconstpointer  v2);
 guint    g_str_hash  (gconstpointer  v);
 
-gboolean g_int_equal (gconstpointer  v,
-                      gconstpointer  v2) G_GNUC_CONST;
-guint    g_int_hash  (gconstpointer  v) G_GNUC_CONST;
+gboolean g_int_equal (gconstpointer  v1,
+                      gconstpointer  v2);
+guint    g_int_hash  (gconstpointer  v);
 
-/* This "hash" function will just return the key's adress as an
- * unsigned integer. Useful for hashing on plain adresses or
+/* This "hash" function will just return the key's address as an
+ * unsigned integer. Useful for hashing on plain addresses or
  * simple integer values.
- * passing NULL into g_hash_table_new() as GHashFunc has the
+ * Passing NULL into g_hash_table_new() as GHashFunc has the
  * same effect as passing g_direct_hash().
  */
 guint    g_direct_hash  (gconstpointer  v) G_GNUC_CONST;
-gboolean g_direct_equal (gconstpointer  v,
+gboolean g_direct_equal (gconstpointer  v1,
                          gconstpointer  v2) G_GNUC_CONST;
 
 G_END_DECLS