(patch) proposed GCompareFunc cleanup
- From: Jeff Garzik <jgarzik pobox com>
- To: gtk-devel-list redhat com
- Subject: (patch) proposed GCompareFunc cleanup
- Date: Sat, 23 Jan 1999 23:34:42 -0500 (EST)
As I noted in an earlier e-mail, hash table-related GCompareFunc usage
is 180 degrees difference from the GCompareFunc usage in other modules.
The attached patch is the first cut at cleaning up this problem. I am
reasonably sure that this change is binary compatible; it creates a new
typedef GEqualsFunc, and applies s/GCompareFunc/GEqualsFunc/ for each
module which needs it.
Would this to discuss this and clean it up a bit before committing.
Jeff
Index: gcache.c
===================================================================
RCS file: /debian/home/gnomecvs/glib/gcache.c,v
retrieving revision 1.3
diff -u -r1.3 gcache.c
--- gcache.c 1998/12/16 05:38:17 1.3
+++ gcache.c 1999/01/24 04:29:13
@@ -70,7 +70,7 @@
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
- GCompareFunc key_compare_func)
+ GEqualsFunc key_compare_func)
{
GRealCache *cache;
Index: ghash.c
===================================================================
RCS file: /debian/home/gnomecvs/glib/ghash.c,v
retrieving revision 1.13
diff -u -r1.13 ghash.c
--- ghash.c 1999/01/24 04:18:07 1.13
+++ ghash.c 1999/01/24 04:29:13
@@ -45,7 +45,7 @@
guint frozen;
GHashNode **nodes;
GHashFunc hash_func;
- GCompareFunc key_compare_func;
+ GEqualsFunc key_compare_func;
};
@@ -70,7 +70,7 @@
GHashTable*
g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func)
+ GEqualsFunc key_compare_func)
{
GHashTable *hash_table;
guint i;
Index: glib.h
===================================================================
RCS file: /debian/home/gnomecvs/glib/glib.h,v
retrieving revision 1.111
diff -u -r1.111 glib.h
--- glib.h 1999/01/17 15:21:28 1.111
+++ glib.h 1999/01/24 04:29:23
@@ -743,6 +743,8 @@
typedef void (*GDataForeachFunc) (GQuark key_id,
gpointer data,
gpointer user_data);
+typedef gboolean (*GEqualsFunc) (gconstpointer a,
+ gconstpointer b);
typedef void (*GFunc) (gpointer data,
gpointer user_data);
typedef guint (*GHashFunc) (gconstpointer key);
@@ -934,7 +936,7 @@
/* Hash tables
*/
GHashTable* g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func);
+ GEqualsFunc key_compare_func);
void g_hash_table_destroy (GHashTable *hash_table);
void g_hash_table_insert (GHashTable *hash_table,
gpointer key,
@@ -966,7 +968,7 @@
GCacheDestroyFunc key_destroy_func,
GHashFunc hash_key_func,
GHashFunc hash_value_func,
- GCompareFunc key_compare_func);
+ GEqualsFunc key_compare_func);
void g_cache_destroy (GCache *cache);
gpointer g_cache_insert (GCache *cache,
gpointer key);
@@ -2249,7 +2251,7 @@
void g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
- GCompareFunc key_compare_func);
+ GEqualsFunc key_compare_func);
void g_relation_insert (GRelation *relation,
...);
gint g_relation_delete (GRelation *relation,
Index: grel.c
===================================================================
RCS file: /debian/home/gnomecvs/glib/grel.c,v
retrieving revision 1.5
diff -u -r1.5 grel.c
--- grel.c 1998/12/15 05:27:39 1.5
+++ grel.c 1999/01/24 04:29:24
@@ -78,7 +78,7 @@
return NULL;
}
-static GCompareFunc
+static GEqualsFunc
tuple_equal (gint fields)
{
switch (fields)
@@ -143,7 +143,7 @@
g_relation_index (GRelation *relation,
gint field,
GHashFunc hash_func,
- GCompareFunc key_compare_func)
+ GEqualsFunc key_compare_func)
{
GRealRelation *rel = (GRealRelation *) relation;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]