The uint32 data type

uint32 is a 32bit unsigned integer type. On many systems you can use:

  #include <inttypes.h>
  #define uint32 uint32_t

to get a definition. This is still somewhat unportable, unfortunately. Do not use unsigned int or unsigned long carelessly.

INTEGRATION

Header files

strhash.h includes uint32.h, which is expected to define the uint32 type. The uint32.h provided with the library source may be used together with GNU autoconf.

strhash_io.h provides prototypes for strhash_load and strhash_save.

I used the following invocation of autoconf magic for it, back when i used autoconf:

        AC_CHECK_SIZEOF(unsigned short,2)
        AC_CHECK_SIZEOF(short,2)
        AC_CHECK_SIZEOF(int,4)
        AC_CHECK_SIZEOF(unsigned int,4)
        AC_CHECK_SIZEOF(long,4)
        AC_CHECK_SIZEOF(unsigned long,4)
        AC_CHECK_SIZEOF(long long,0)
        AC_CHECK_SIZEOF(unsigned long long,0)

If HAVE_CONFIG_H is not defined then auto-typesize.h has to define the following C macros, possibly to other values:

        #define SIZEOF_SHORT 2
        #define SIZEOF_INT 4
        #define SIZEOF_LONG 4
        #define SIZEOF_UNSIGNED_SHORT 2
        #define SIZEOF_UNSIGNED_INT 4
        #define SIZEOF_UNSIGNED_LONG 4
        #define SIZEOF_LONG_LONG 8
        #define SIZEOF_UNSIGNED_LONG_LONG 8

If HAVE_CONFIG_H is defined then config.h has to be included before uint32.h.

Source files

Each strhash function of non-trivial size comes in an own source file. All files include another header besides ``strhash.h'': ``strhashi.h'', which defines some internally used macros and functions.

You only need to include those function you really use - with the exception of strhash_get, which is used by strhash_lookup* and strhash_walk* functions.

strhash_chng.c
contains strhash_change.

strhash_crea.c
contains strhash_create.

strhash_del.c
contains strhash_delete.

strhash_dest.c
contains strhash_destroy.

strhash_ente.c
contains strhash_enter.

strhash_get.c
contains strhash_get, a function used by strhash_look.c and strhash_walk.c.

strhash_hash.c
contains strhash_hash.

strhash_look.c
contains strhash_lookupstart, strhash_lookupnext and strhash_lookup.

strhash_walk.c
contains strhash_walkstart and strhash_walk.

strhash_load.c
contains strhash_load. Note that strhash_load depends on the buffer, stralloc and byte interfaces and is not useful without them.

strhash_save.c
contains strhash_save. Note that strhash_save depends on the buffer, stralloc and byte interfaces and is not useful without them.

DJB STYLE LIBRARIES

If you choose to not use the standard C library functions then you may define the DJBLIBS symbol before compiling the library files. This will make the library use alloc, alloc_free and byte_copy instead of malloc, free and memcpy.

SEE ALSO

The strhash library interface: libstrhash(3), the strhash homepage