comparison src/ui-gtk.c @ 2515:de9952d2ed18

[xemacs-hg @ 2005-01-26 10:22:19 by ben] Hash table cleanups, part 1 of 2 emacs-marshals.c, hash.c, hash.h, ui-gtk.c: Clean up and generalize creation of string hash tables. ui-gtk.c, elhash.h, gccache-gtk.c, glyphs-gtk.c, lrecord.h, marker.c, objects-gtk.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, opaque.c, rangetab.c, specifier.c, specifier.h, xgccache.c: Use Hashcode rather than unsigned long.
author ben
date Wed, 26 Jan 2005 10:22:29 +0000
parents 3d8143fc88e1
children 6fa9919a9a0b
comparison
equal deleted inserted replaced
2514:b49d38bc659d 2515:de9952d2ed18
103 103
104 /* Gtk object importing */ 104 /* Gtk object importing */
105 EXFUN (Fgtk_import_type, 1); 105 EXFUN (Fgtk_import_type, 1);
106 106
107 static struct hash_table *internal_type_hash; 107 static struct hash_table *internal_type_hash;
108
109 static int
110 type_hash_equal(const void *arg1, const void *arg2)
111 {
112 return ((GtkType) arg1 == (GtkType) arg2);
113 }
114
115 static unsigned long
116 type_hash_hash(const void *arg)
117 {
118 return ((unsigned long) arg);
119 }
120 108
121 static int 109 static int
122 type_already_imported_p (GtkType t) 110 type_already_imported_p (GtkType t)
123 { 111 {
124 void *retval = NULL; 112 void *retval = NULL;
146 return (1); 134 return (1);
147 } 135 }
148 136
149 if (!internal_type_hash) 137 if (!internal_type_hash)
150 { 138 {
151 internal_type_hash = make_general_hash_table (163, type_hash_hash, type_hash_equal); 139 internal_type_hash = make_hash_table (163);
152 return (0); 140 return (0);
153 } 141 }
154 142
155 if (gethash ((void *)t, internal_type_hash, (const void **)&retval)) 143 if (gethash ((void *)t, internal_type_hash, (const void **)&retval))
156 { 144 {
1126 1114
1127 return ((data1->object == data2->object) && 1115 return ((data1->object == data2->object) &&
1128 (data1->object_type == data2->object_type)); 1116 (data1->object_type == data2->object_type));
1129 } 1117 }
1130 1118
1131 static unsigned long 1119 static Hashcode
1132 emacs_gtk_boxed_hash (Lisp_Object obj, int UNUSED (depth)) 1120 emacs_gtk_boxed_hash (Lisp_Object obj, int UNUSED (depth))
1133 { 1121 {
1134 emacs_gtk_boxed_data *data = XGTK_BOXED(obj); 1122 emacs_gtk_boxed_data *data = XGTK_BOXED(obj);
1135 return (HASH2 ((unsigned long)data->object, data->object_type)); 1123 return (HASH2 ((Hashcode) data->object, data->object_type));
1136 } 1124 }
1137 1125
1138 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("GtkBoxed", emacs_gtk_boxed, 1126 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("GtkBoxed", emacs_gtk_boxed,
1139 0, /*dumpable-flag*/ 1127 0, /*dumpable-flag*/
1140 0, /* marker function */ 1128 0, /* marker function */