glib string hashes?
- From: "Christopher T. Lansdown" <lansdoct screech cs alfred edu>
- To: gnome-devel-list gnome org, "GTK+ App Developer's Mailing List." <gtk-app-devel-list redhat com>
- Subject: glib string hashes?
- Date: Tue, 13 Jul 1999 15:26:16 -0400 (EDT)
Hi,
Does anyone have experience using glib hashes with the g_str_hash?
Does anyone know if it handles hash collides intelligently? A bit of
output:
Inserted the variable ContentType into the hash with the expansion CDATA.
The table now has 1 entities.
Inserted the variable ContentTypes into the hash with the expansion CDATA.
The table now has 2 entities.
Inserted the variable Charset into the hash with the expansion CDATA.
The table now has 3 entities.
Inserted the variable Charsets into the hash with the expansion CDATA.
The table now has 4 entities.
Hm, there seems to be a multiple definition of the entity LanguageCode.
Inserted the variable LanguageCode into the hash with the expansion NAME.
The table now has 4 entities.
You don't want to see the code, but suffice it to say that the basic order
is:
GHashTable *hash;
char *string, expansion_argument;
hash = g_hash_table_new(g_str_hash, g_str_equal);
while(stuff go on here) {
...
if(g_hash_table_lookup(hash, string))
printf("Hm, there seems to be ... entity %s.\n", string);
g_hash_table_insert(hash, string, expansion_argument);
printf("Inserted the variable %s into the hash ... %s.\n", string,
expansion_argument);
printf("The table now has %i entities.\n", g_hash_table_size(hash));
...
}
Am I doing something wrong here, or does it just look like I'm getting a
hash table collision which isn't being handled properly? What happens
when 2 strings provide the same hash key, does glib handle this? Is this
a glib bug? Any and all help is greatly appreciate. Thanks.
-Chris
--
lansdoct@cs.alfred.edu
"If I had had more time I would have not written you at all." - Pascal
Linux Programs: http://cs.alfred.edu/~lansdoct/linux/
Linux - Get there. Today.
Evil Overlord Quote of the Day:
150.I will provide funding and research to develop tactical and strategic
weapons covering a full range of needs so my choices are not limited to
"hand to hand combat with swords" and "blow up the planet".
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]