#include "common.h"
#include <stdlib.h>
#include <sys/types.h>
#include <assert.h>
#include "xmalloc.h"
#include "xhash_tmpl_h.inc"
#include "mlist_tmpl_h.inc"
#include "mlist_tmpl_c.inc"
Include dependency graph for xhash_tmpl_c.inc:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
This module contains a data type independant hash table (external hashing) template. It can easily be customized for new data types by defining XH_TABLE_NAME
, which becomes the name of the new has-table "class", XH_FUNC_PFX
, which is prepended to all function names listed below, XH_KEY
which must expand to the table's keys data type and XH_CARGO
which specifies the actual data type to be stored.
In case the hash table should store a non-integral data type like a struct, the macro ML_INVALID
must be defined whose value is returned as an error indicator by functions returning an MlCargo
object. If undefined ML_INVALID
is set to 0L
which should be a reasonable default in many cases.
Following things can be defined optionally:
ML_IS_VALID_CARGO(cargo)
true
if cargo
is valid. Defaults to !cargo
!
= ML_INVALID
".ML_CREATE_CARGO(cargo)
cargo
so actual data can be stored in it. Defaults to a NOOP.ML_COPY_CARGO(dest, source)
MlCargo
object source
into dest
. dest
will have been prepared using ML_CREATE_CARGO, if nessessary. Defaults to "dest
= \c
source".ML_FREE_CARGO(cargo)
ML_FREE_CARGO
is used on MlCargo
objects which have been prepared using ML_CREATE_CARGO
and are no longer used. Should free all ressources allocated by ML_CREATE_CARGO
. Defaults to a NOOP.
Definition in file xhash_tmpl_c.inc.