Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

htable2.h File Reference


Detailed Description

Defined when <sofia-sip/htable2.h> has been included.

Hash tables templates, take 2.

Note: this version can handle structures as entries, and it can be used without <su_alloc.h>.

This file contain a hash table template for C. The hash tables are resizeable, and they usually contain pointers to entries. The declaration for template datatypes is instantiated with macro HTABLE2_DECLARE(). The prototypes for hashing functions are instantiated with macro HTABLE2_PROTOS(). The implementation is instantiated with macro HTABLE2_BODIES().

The hash table template is most efficient when the hash value is precalculated and stored in each entry. The hash "function" given to the HTABLE2_BODIES() would then be something like macro

 #define HTABLE2_ENTRY_HASH(e) ((e).e_hash_value)

When a entry with new identical hash key is added to the table, it can be either inserted (before any other entry with same key value) or appended.

Example code can be found from <htable_test.c>.

Author:
Pekka Pessi <Pekka.Pessi@nokia.com>.
Date:
Created: Tue Sep 25 17:42:40 2001 ppessi

Definition in file htable2.h.

Go to the source code of this file.

Defines

#define HTABLE2_BODIES(type, prefix, pr, entrytype,hfun, is_used, reclaim, is_equal, halloc)
#define HTABLE2_DECLARE(sname, prefix, pr, entrytype)
#define HTABLE2_MIN_SIZE   31
#define HTABLE2_PROTOS(type, prefix, pr, entrytype)
#define HTABLE2_SCOPE   static inline

Typedefs

typedef unsigned long hash_value_t


Generated by  Doxygen 1.6.0   Back to index