Skip to content
  • Erkki Seppälä's avatar
    Xext: add a generic hashtable implementation · ccb3e781
    Erkki Seppälä authored
    
    
    The generic hashtable implementation adds a key-value container, that
    keeps the key and value inside the hashtable structure and manages
    their memory by itself. This data structure is best suited for
    fixed-length keys and values.
    
    One creates a new hash table with ht_create and disposes it with
    ht_destroy. ht_create accepts the key and value sizes (in bytes) in
    addition to the hashing and comparison functions to use. When adding
    keys with ht_add, they will be copied into the hash and a pointer to
    the value will be returned: data may be put into this structure (or if
    the hash table is to be used as a set, one can just not put anything
    in).
    
    The hash table comes also with one generic hashing function plus a
    comparison function to facilitate ease of use. It also has a custom
    hashing and comparison functions for hashing resource IDs with
    HashXID.
    
    Reviewed-by: default avatarRami Ylimäki <rami.ylimaki@vincit.fi>
    Signed-off-by: default avatarErkki Seppälä <erkki.seppala@vincit.fi>
    ccb3e781