"Fossies" - the Fresh Open Source Software Archive

Member "hash.h" (9 May 1995, 2160 Bytes) of package /linux/misc/old/cpost.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "hash.h" see the Fossies "Dox" file reference documentation.

    1 /*------------------------------------------------------------------
    2  * hash.h : hash table functions
    3  *------------------------------------------------------------------
    4  * 10-19-88 originally by Patrick J. Mueller
    5  * 08-07-92 fixed up by Patrick J. Mueller
    6  *------------------------------------------------------------------*/
    7 
    8 #if !defined(HASH_H_INCLUDED)
    9 #define HASH_H_INCLUDED
   10 
   11 typedef int HashFunc     (void *pItem, int buckets);
   12 
   13 typedef struct
   14    {
   15    int                itemSize;
   16    int                buckets;
   17    List             **bucket;
   18    HashFunc          *hashFunc;
   19    ListNoMemFunc     *memFunc;
   20    } Hash;
   21 
   22 /*------------------------------------------------------------------
   23  * create a hash table
   24  *------------------------------------------------------------------*/
   25 Hash *HashCreate(
   26    int                  itemSize,
   27    int                  buckets,
   28    HashFunc            *hashFunc,
   29    ListCompareFunc     *cmpFunc,
   30    ListNoMemFunc       *memFunc
   31    );
   32 
   33 /*------------------------------------------------------------------
   34  * destroy a hash table
   35  *------------------------------------------------------------------*/
   36 void HashDestroy(
   37    Hash *hash
   38    );
   39 
   40 /*------------------------------------------------------------------
   41  * find an entry in a hash table
   42  *------------------------------------------------------------------*/
   43 void *HashFind(
   44    Hash  *hash,
   45    void  *pItem
   46    );
   47 
   48 /*------------------------------------------------------------------
   49  * add an entry to a hash table
   50  *------------------------------------------------------------------*/
   51 void *HashAdd(
   52    Hash *hash,
   53    void *pItem
   54    );
   55 
   56 /*------------------------------------------------------------------
   57  * delete an entry from a hash table
   58  *------------------------------------------------------------------*/
   59 void HashDelete(
   60    Hash *hash,
   61    void *pTtem
   62    );
   63 
   64 /*------------------------------------------------------------------
   65  * iterate through hash table
   66  *------------------------------------------------------------------*/
   67 void HashIterate(
   68    Hash            *hash,
   69    ListIterateFunc *pIterateFunc,
   70    void            *pUserData
   71    );
   72 
   73 #endif