summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>2000-10-30 14:34:52 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>2000-10-30 14:34:52 +0000
commit267b6813703e24ef60d0e8ba42557c414f9dd52e (patch)
tree555ac313ee58d9ea4f7a68855d16ee6c485e54bf
parentd42361a6e3d60fc6b926eae47a7aed85dedfd397 (diff)
downloadglib-267b6813703e24ef60d0e8ba42557c414f9dd52e.tar.gz
Introduced new function type GEqualFunc to return TRUE for equal params.
2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h: Introduced new function type GEqualFunc to return TRUE for equal params. This is now used instead of GCompareFunc (which should work akin to strcmp) here. This kind of fixes Bug #14412. Note that technically GCompareFunc and GEqualFunc are still the same types, as gint == gboolean. * ghash.h, gutils.c: g_int_equal and g_direct_equal now return gboolean to be really become GEqualFunc. * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to follow the above change.
-rw-r--r--ChangeLog15
-rw-r--r--ChangeLog.pre-2-015
-rw-r--r--ChangeLog.pre-2-1015
-rw-r--r--ChangeLog.pre-2-1215
-rw-r--r--ChangeLog.pre-2-215
-rw-r--r--ChangeLog.pre-2-415
-rw-r--r--ChangeLog.pre-2-615
-rw-r--r--ChangeLog.pre-2-815
-rw-r--r--gcache.c6
-rw-r--r--gcache.h2
-rw-r--r--ghash.c12
-rw-r--r--ghash.h10
-rw-r--r--glib/gcache.c6
-rw-r--r--glib/gcache.h2
-rw-r--r--glib/ghash.c12
-rw-r--r--glib/ghash.h10
-rw-r--r--glib/grel.c6
-rw-r--r--glib/grel.h2
-rw-r--r--glib/gscanner.c4
-rw-r--r--glib/gtypes.h2
-rw-r--r--glib/gutils.c4
-rw-r--r--grel.c6
-rw-r--r--grel.h2
-rw-r--r--gscanner.c4
-rw-r--r--gtypes.h2
-rw-r--r--gutils.c4
-rw-r--r--testglib.c8
-rw-r--r--tests/hash-test.c14
-rw-r--r--tests/testglib.c8
29 files changed, 184 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index b42044f33..7fedca6dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index b42044f33..7fedca6dc 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,18 @@
+2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gcache.h, gcache.c, ghash.h, ghash.c, grel.c, grel.h, gtypes.h:
+ Introduced new function type GEqualFunc to return TRUE for equal
+ params. This is now used instead of GCompareFunc (which should
+ work akin to strcmp) here. This kind of fixes Bug #14412. Note
+ that technically GCompareFunc and GEqualFunc are still the same
+ types, as gint == gboolean.
+
+ * ghash.h, gutils.c: g_int_equal and g_direct_equal now return
+ gboolean to be really become GEqualFunc.
+
+ * gscanner.c, testglib.c, tests/hash-test.c: Some tiny changes to
+ follow the above change.
+
2000-10-27 Tor Lillqvist <tml@iki.fi>
* makefile.{mingw,msc}.in (glib_OBJECTS): Add gmarkup.
diff --git a/gcache.c b/gcache.c
index 1b5518efe..5a06e0eeb 100644
--- a/gcache.c
+++ b/gcache.c
@@ -77,7 +77,7 @@ g_cache_new (GCacheNewFunc value_new_func,
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
- GCompareFunc key_compare_func)
+ GEqualFunc key_equal_func)
{
GRealCache *cache;
@@ -87,14 +87,14 @@ g_cache_new (GCacheNewFunc value_new_func,
g_return_val_if_fail (key_destroy_func != NULL, NULL);
g_return_val_if_fail (hash_key_func != NULL, NULL);
g_return_val_if_fail (hash_value_func != NULL, NULL);
- g_return_val_if_fail (key_compare_func != NULL, NULL);
+ g_return_val_if_fail (key_equal_func != NULL, NULL);
cache = g_new (GRealCache, 1);
cache->value_new_func = value_new_func;
cache->value_destroy_func = value_destroy_func;
cache->key_dup_func = key_dup_func;
cache->key_destroy_func = key_destroy_func;
- cache->key_table = g_hash_table_new (hash_key_func, key_compare_func);
+ cache->key_table = g_hash_table_new (hash_key_func, key_equal_func);
cache->value_table = g_hash_table_new (hash_value_func, NULL);
return (GCache*) cache;
diff --git a/gcache.h b/gcache.h
index 10b5c910d..74ef5b654 100644
--- a/gcache.h
+++ b/gcache.h
@@ -45,7 +45,7 @@ GCache* g_cache_new (GCacheNewFunc value_new_func,
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
- GCompareFunc key_compare_func);
+ GEqualFunc key_equal_func);
void g_cache_destroy (GCache *cache);
gpointer g_cache_insert (GCache *cache,
gpointer key);
diff --git a/ghash.c b/ghash.c
index a664e8713..d35df1843 100644
--- a/ghash.c
+++ b/ghash.c
@@ -50,7 +50,7 @@ struct _GHashTable
gint nnodes;
GHashNode **nodes;
GHashFunc hash_func;
- GCompareFunc key_compare_func;
+ GEqualFunc key_equal_func;
};
@@ -71,7 +71,7 @@ static GHashNode *node_free_list = NULL;
GHashTable*
g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func)
+ GEqualFunc key_equal_func)
{
GHashTable *hash_table;
guint i;
@@ -80,7 +80,7 @@ g_hash_table_new (GHashFunc hash_func,
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
- hash_table->key_compare_func = key_compare_func;
+ hash_table->key_equal_func = key_equal_func;
hash_table->nodes = g_new (GHashNode*, hash_table->size);
for (i = 0; i < hash_table->size; i++)
@@ -114,11 +114,11 @@ g_hash_table_lookup_node (GHashTable *hash_table,
/* Hash table lookup needs to be fast.
* We therefore remove the extra conditional of testing
- * whether to call the key_compare_func or not from
+ * whether to call the key_equal_func or not from
* the inner loop.
*/
- if (hash_table->key_compare_func)
- while (*node && !(*hash_table->key_compare_func) ((*node)->key, key))
+ if (hash_table->key_equal_func)
+ while (*node && !(*hash_table->key_equal_func) ((*node)->key, key))
node = &(*node)->next;
else
while (*node && (*node)->key != key)
diff --git a/ghash.h b/ghash.h
index 280ad6008..2f6413151 100644
--- a/ghash.h
+++ b/ghash.h
@@ -40,7 +40,7 @@ typedef gboolean (*GHRFunc) (gpointer key,
/* Hash tables
*/
GHashTable* g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func);
+ GEqualFunc key_equal_func);
void g_hash_table_destroy (GHashTable *hash_table);
void g_hash_table_insert (GHashTable *hash_table,
gpointer key,
@@ -72,7 +72,7 @@ gboolean g_str_equal (gconstpointer v,
gconstpointer v2);
guint g_str_hash (gconstpointer v);
-gint g_int_equal (gconstpointer v,
+gboolean g_int_equal (gconstpointer v,
gconstpointer v2) G_GNUC_CONST;
guint g_int_hash (gconstpointer v) G_GNUC_CONST;
@@ -82,9 +82,9 @@ guint g_int_hash (gconstpointer v) G_GNUC_CONST;
* 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;
-gint g_direct_equal (gconstpointer v,
- gconstpointer v2) G_GNUC_CONST;
+guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
+gboolean g_direct_equal (gconstpointer v,
+ gconstpointer v2) G_GNUC_CONST;
G_END_DECLS
diff --git a/glib/gcache.c b/glib/gcache.c
index 1b5518efe..5a06e0eeb 100644
--- a/glib/gcache.c
+++ b/glib/gcache.c
@@ -77,7 +77,7 @@ g_cache_new (GCacheNewFunc value_new_func,
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
- GCompareFunc key_compare_func)
+ GEqualFunc key_equal_func)
{
GRealCache *cache;
@@ -87,14 +87,14 @@ g_cache_new (GCacheNewFunc value_new_func,
g_return_val_if_fail (key_destroy_func != NULL, NULL);
g_return_val_if_fail (hash_key_func != NULL, NULL);
g_return_val_if_fail (hash_value_func != NULL, NULL);
- g_return_val_if_fail (key_compare_func != NULL, NULL);
+ g_return_val_if_fail (key_equal_func != NULL, NULL);
cache = g_new (GRealCache, 1);
cache->value_new_func = value_new_func;
cache->value_destroy_func = value_destroy_func;
cache->key_dup_func = key_dup_func;
cache->key_destroy_func = key_destroy_func;
- cache->key_table = g_hash_table_new (hash_key_func, key_compare_func);
+ cache->key_table = g_hash_table_new (hash_key_func, key_equal_func);
cache->value_table = g_hash_table_new (hash_value_func, NULL);
return (GCache*) cache;
diff --git a/glib/gcache.h b/glib/gcache.h
index 10b5c910d..74ef5b654 100644
--- a/glib/gcache.h
+++ b/glib/gcache.h
@@ -45,7 +45,7 @@ GCache* g_cache_new (GCacheNewFunc value_new_func,
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
- GCompareFunc key_compare_func);
+ GEqualFunc key_equal_func);
void g_cache_destroy (GCache *cache);
gpointer g_cache_insert (GCache *cache,
gpointer key);
diff --git a/glib/ghash.c b/glib/ghash.c
index a664e8713..d35df1843 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -50,7 +50,7 @@ struct _GHashTable
gint nnodes;
GHashNode **nodes;
GHashFunc hash_func;
- GCompareFunc key_compare_func;
+ GEqualFunc key_equal_func;
};
@@ -71,7 +71,7 @@ static GHashNode *node_free_list = NULL;
GHashTable*
g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func)
+ GEqualFunc key_equal_func)
{
GHashTable *hash_table;
guint i;
@@ -80,7 +80,7 @@ g_hash_table_new (GHashFunc hash_func,
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
- hash_table->key_compare_func = key_compare_func;
+ hash_table->key_equal_func = key_equal_func;
hash_table->nodes = g_new (GHashNode*, hash_table->size);
for (i = 0; i < hash_table->size; i++)
@@ -114,11 +114,11 @@ g_hash_table_lookup_node (GHashTable *hash_table,
/* Hash table lookup needs to be fast.
* We therefore remove the extra conditional of testing
- * whether to call the key_compare_func or not from
+ * whether to call the key_equal_func or not from
* the inner loop.
*/
- if (hash_table->key_compare_func)
- while (*node && !(*hash_table->key_compare_func) ((*node)->key, key))
+ if (hash_table->key_equal_func)
+ while (*node && !(*hash_table->key_equal_func) ((*node)->key, key))
node = &(*node)->next;
else
while (*node && (*node)->key != key)
diff --git a/glib/ghash.h b/glib/ghash.h
index 280ad6008..2f6413151 100644
--- a/glib/ghash.h
+++ b/glib/ghash.h
@@ -40,7 +40,7 @@ typedef gboolean (*GHRFunc) (gpointer key,
/* Hash tables
*/
GHashTable* g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func);
+ GEqualFunc key_equal_func);
void g_hash_table_destroy (GHashTable *hash_table);
void g_hash_table_insert (GHashTable *hash_table,
gpointer key,
@@ -72,7 +72,7 @@ gboolean g_str_equal (gconstpointer v,
gconstpointer v2);
guint g_str_hash (gconstpointer v);
-gint g_int_equal (gconstpointer v,
+gboolean g_int_equal (gconstpointer v,
gconstpointer v2) G_GNUC_CONST;
guint g_int_hash (gconstpointer v) G_GNUC_CONST;
@@ -82,9 +82,9 @@ guint g_int_hash (gconstpointer v) G_GNUC_CONST;
* 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;
-gint g_direct_equal (gconstpointer v,
- gconstpointer v2) G_GNUC_CONST;
+guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
+gboolean g_direct_equal (gconstpointer v,
+ gconstpointer v2) G_GNUC_CONST;
G_END_DECLS
diff --git a/glib/grel.c b/glib/grel.c
index 9e4f3287d..1e82b26e4 100644
--- a/glib/grel.c
+++ b/glib/grel.c
@@ -85,7 +85,7 @@ tuple_hash (gint fields)
return NULL;
}
-static GCompareFunc
+static GEqualFunc
tuple_equal (gint fields)
{
switch (fields)
@@ -150,7 +150,7 @@ void
g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
- GCompareFunc key_compare_func)
+ GEqualFunc key_equal_func)
{
GRealRelation *rel = (GRealRelation *) relation;
@@ -158,7 +158,7 @@ g_relation_index (GRelation *relation,
g_return_if_fail (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
- rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
+ rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_equal_func);
}
void
diff --git a/glib/grel.h b/glib/grel.h
index 09b2e23ab..fcf8eab45 100644
--- a/glib/grel.h
+++ b/glib/grel.h
@@ -67,7 +67,7 @@ void g_relation_destroy (GRelation *relation);
void g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
- GCompareFunc key_compare_func);
+ GEqualFunc key_equal_func);
void g_relation_insert (GRelation *relation,
...);
gint g_relation_delete (GRelation *relation,
diff --git a/glib/gscanner.c b/glib/gscanner.c
index 8839dff88..3291a8c64 100644
--- a/glib/gscanner.c
+++ b/glib/gscanner.c
@@ -127,7 +127,7 @@ static inline
GScannerKey* g_scanner_lookup_internal (GScanner *scanner,
guint scope_id,
const gchar *symbol);
-static gint g_scanner_key_equal (gconstpointer v1,
+static gboolean g_scanner_key_equal (gconstpointer v1,
gconstpointer v2);
static guint g_scanner_key_hash (gconstpointer v);
static void g_scanner_get_token_ll (GScanner *scanner,
@@ -346,7 +346,7 @@ g_scanner_warn (GScanner *scanner,
}
}
-static gint
+static gboolean
g_scanner_key_equal (gconstpointer v1,
gconstpointer v2)
{
diff --git a/glib/gtypes.h b/glib/gtypes.h
index cfe572b1f..5f7d4937f 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -69,6 +69,8 @@ typedef const void *gconstpointer;
typedef gint (*GCompareFunc) (gconstpointer a,
gconstpointer b);
+typedef gboolean (*GEqualFunc) (gconstpointer a,
+ gconstpointer b);
typedef void (*GDestroyNotify) (gpointer data);
typedef void (*GFunc) (gpointer data,
gpointer user_data);
diff --git a/glib/gutils.c b/glib/gutils.c
index 4910beb0c..fac67375d 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -917,14 +917,14 @@ g_direct_hash (gconstpointer v)
return GPOINTER_TO_UINT (v);
}
-gint
+gboolean
g_direct_equal (gconstpointer v1,
gconstpointer v2)
{
return v1 == v2;
}
-gint
+gboolean
g_int_equal (gconstpointer v1,
gconstpointer v2)
{
diff --git a/grel.c b/grel.c
index 9e4f3287d..1e82b26e4 100644
--- a/grel.c
+++ b/grel.c
@@ -85,7 +85,7 @@ tuple_hash (gint fields)
return NULL;
}
-static GCompareFunc
+static GEqualFunc
tuple_equal (gint fields)
{
switch (fields)
@@ -150,7 +150,7 @@ void
g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
- GCompareFunc key_compare_func)
+ GEqualFunc key_equal_func)
{
GRealRelation *rel = (GRealRelation *) relation;
@@ -158,7 +158,7 @@ g_relation_index (GRelation *relation,
g_return_if_fail (rel->count == 0 && rel->hashed_tuple_tables[field] == NULL);
- rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_compare_func);
+ rel->hashed_tuple_tables[field] = g_hash_table_new (hash_func, key_equal_func);
}
void
diff --git a/grel.h b/grel.h
index 09b2e23ab..fcf8eab45 100644
--- a/grel.h
+++ b/grel.h
@@ -67,7 +67,7 @@ void g_relation_destroy (GRelation *relation);
void g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
- GCompareFunc key_compare_func);
+ GEqualFunc key_equal_func);
void g_relation_insert (GRelation *relation,
...);
gint g_relation_delete (GRelation *relation,
diff --git a/gscanner.c b/gscanner.c
index 8839dff88..3291a8c64 100644
--- a/gscanner.c
+++ b/gscanner.c
@@ -127,7 +127,7 @@ static inline
GScannerKey* g_scanner_lookup_internal (GScanner *scanner,
guint scope_id,
const gchar *symbol);
-static gint g_scanner_key_equal (gconstpointer v1,
+static gboolean g_scanner_key_equal (gconstpointer v1,
gconstpointer v2);
static guint g_scanner_key_hash (gconstpointer v);
static void g_scanner_get_token_ll (GScanner *scanner,
@@ -346,7 +346,7 @@ g_scanner_warn (GScanner *scanner,
}
}
-static gint
+static gboolean
g_scanner_key_equal (gconstpointer v1,
gconstpointer v2)
{
diff --git a/gtypes.h b/gtypes.h
index cfe572b1f..5f7d4937f 100644
--- a/gtypes.h
+++ b/gtypes.h
@@ -69,6 +69,8 @@ typedef const void *gconstpointer;
typedef gint (*GCompareFunc) (gconstpointer a,
gconstpointer b);
+typedef gboolean (*GEqualFunc) (gconstpointer a,
+ gconstpointer b);
typedef void (*GDestroyNotify) (gpointer data);
typedef void (*GFunc) (gpointer data,
gpointer user_data);
diff --git a/gutils.c b/gutils.c
index 4910beb0c..fac67375d 100644
--- a/gutils.c
+++ b/gutils.c
@@ -917,14 +917,14 @@ g_direct_hash (gconstpointer v)
return GPOINTER_TO_UINT (v);
}
-gint
+gboolean
g_direct_equal (gconstpointer v1,
gconstpointer v2)
{
return v1 == v2;
}
-gint
+gboolean
g_int_equal (gconstpointer v1,
gconstpointer v2)
{
diff --git a/testglib.c b/testglib.c
index 08b4c4b30..cb8f50f2e 100644
--- a/testglib.c
+++ b/testglib.c
@@ -238,9 +238,9 @@ my_hash (gconstpointer key)
return (guint) *((const gint*) key);
}
-static gint
-my_hash_compare (gconstpointer a,
- gconstpointer b)
+static gboolean
+my_hash_equal (gconstpointer a,
+ gconstpointer b)
{
return *((const gint*) a) == *((const gint*) b);
}
@@ -617,7 +617,7 @@ main (int argc,
g_print ("checking hash tables...");
- hash_table = g_hash_table_new (my_hash, my_hash_compare);
+ hash_table = g_hash_table_new (my_hash, my_hash_equal);
for (i = 0; i < 10000; i++)
{
array[i] = i;
diff --git a/tests/hash-test.c b/tests/hash-test.c
index bcd6ddbe3..f295d6aaf 100644
--- a/tests/hash-test.c
+++ b/tests/hash-test.c
@@ -84,9 +84,9 @@ my_hash (gconstpointer key)
return (guint) *((const gint*) key);
}
-static gint
-my_hash_compare (gconstpointer a,
- gconstpointer b)
+static gboolean
+my_hash_equal (gconstpointer a,
+ gconstpointer b)
{
return *((const gint*) a) == *((const gint*) b);
}
@@ -160,11 +160,9 @@ static guint honeyman_hash(gconstpointer key)
}
-static gint second_hash_cmp (gconstpointer a, gconstpointer b)
+static gboolean second_hash_cmp (gconstpointer a, gconstpointer b)
{
- gint rc = (strcmp (a, b) == 0);
-
- return rc;
+ return (strcmp (a, b) == 0);
}
@@ -336,7 +334,7 @@ main (int argc,
GHashTable *hash_table;
gint i;
- hash_table = g_hash_table_new (my_hash, my_hash_compare);
+ hash_table = g_hash_table_new (my_hash, my_hash_equal);
for (i = 0; i < 10000; i++)
{
array[i] = i;
diff --git a/tests/testglib.c b/tests/testglib.c
index 08b4c4b30..cb8f50f2e 100644
--- a/tests/testglib.c
+++ b/tests/testglib.c
@@ -238,9 +238,9 @@ my_hash (gconstpointer key)
return (guint) *((const gint*) key);
}
-static gint
-my_hash_compare (gconstpointer a,
- gconstpointer b)
+static gboolean
+my_hash_equal (gconstpointer a,
+ gconstpointer b)
{
return *((const gint*) a) == *((const gint*) b);
}
@@ -617,7 +617,7 @@ main (int argc,
g_print ("checking hash tables...");
- hash_table = g_hash_table_new (my_hash, my_hash_compare);
+ hash_table = g_hash_table_new (my_hash, my_hash_equal);
for (i = 0; i < 10000; i++)
{
array[i] = i;