index  news

Modified 2007-07-15 09:16

libghthash

libghthash is a Generic Hash Table which is meant to be easy to extend, portable, clear in its code and easy to use. You can store any kind of data in it, regardless of size etc. It should be fairly portable, and has been successfully tried on Linux/x86, Solaris/SPARC and Win2000/x86 so far.

libghthash is available prepackaged for

Only not in Debian which I use :-). Google tells me about a few places where it has been used:

I have written a page about hash table performance, where libghthash is compared to the C++ STL hash_map and GNU libc hsearch.

Download

You can download libghthash below. It should compile and work on most platforms, although operating systems not using GNU Autoconf probably have to compile the library by hand. If you're on a UNIX system, don't worry ;-)

libghthash-0.6.2.tar.gz(source, 333 Kb).

The old versions are available here:

libghthash-0.6.1.tar.gz(source, 316 Kb).

libghthash-0.6.0.tar.gz(source, 237 Kb).

libghthash-0.5.6.tar.gz(source, 300 Kb).

libghthash-0.5.5.tar.gz(source, 319 Kb).

libghthash-0.5.4.tar.gz(source, 213 Kb).

libghthash-0.5.3.tar.gz(source, 206 Kb).

libghthash-0.5.2.tar.gz(source, 204 Kb).

libghthash-0.5.1.tar.gz(source, 206 Kb).

libghthash-0.5.0.tar.gz(source, 138 Kb).

libghthash-mk2-0.4.tar.gz(source, 42 Kb).

libghthash-0.4.tar.gz(source, 37 Kb).

libghthash-0.3.tar.gz(source, 35 Kb).

libghthash-0.2.tar.gz(source, 15 Kb).

libghthash-0.1.tar.gz(source, 14 Kb).

Changes

The changes from 0.6.1 to 0.6.2 are:

Documentation

I have built the documentation with doxygen, using javadoc-style comments.

libghthash.

FAQ

Not too many questions have been asked, but:

Is libghthash threadsafe?

No, its not. However, just lock access to the insertion/lookup/iterating functions and it should behave in threaded environments.

My program crashes when I remove items within an iteration!

It is only safe to remove the current entry in the iteration or an entry which has already been iterated over.

To remove all entries from the hash table (when quitting the program), you can instead do the following:

for(p = ght_first(p_ht, &iterator); p; p = ght_next(p, &iterator))
  {
    free(p);
  }

ght_finalize(p_ht);

To contact me, mail to the following address (decrypted):

ska[at]bth[dot]se

You can click here to see some statistics on the page.