Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

Hash Tables


Defines

#define APR_HASH_KEY_STRING   (-1)

Typedefs

typedef apr_hash_t apr_hash_t
typedef apr_hash_index_t apr_hash_index_t

Functions

 APR_DECLARE (apr_hash_t *) apr_hash_make(apr_pool_t *pool)
 APR_DECLARE (void) apr_hash_set(apr_hash_t *ht
 APR_DECLARE (void *) apr_hash_get(apr_hash_t *ht
 APR_DECLARE (apr_hash_index_t *) apr_hash_first(apr_pool_t *p
 APR_DECLARE (unsigned int) apr_hash_count(apr_hash_t *ht)
 APR_POOL_DECLARE_ACCESSOR (hash)

Variables

const apr_hash_th
const void * key
const void apr_ssize_t klen
const void apr_ssize_t const
void * 
val
apr_hash_tht
const apr_hash_toverlay
const apr_hash_t const apr_hash_tbase
const apr_hash_th1
const apr_hash_t const apr_hash_th2
const apr_hash_t const apr_hash_t
void *(* 
merger )(apr_pool_t *p, const void *key, apr_ssize_t klen, const void *h1_val, const void *h2_val, const void *data)
const apr_hash_t const apr_hash_t
void *(*) const void 
data )

Define Documentation

#define APR_HASH_KEY_STRING   (-1)
 

When passing a key to apr_hash_set or apr_hash_get, this value can be passed to indicate a string-valued key, and have apr_hash compute the length automatically.

Remarks:
apr_hash will use strlen(key) for the length. The null-terminator is not included in the hash value (why throw a constant in?). Since the hash table merely references the provided key (rather than copying it), apr_hash_this() will return the null-term'd key.

Definition at line 47 of file apr_hash.h.

Referenced by add_ct_output_filters(), add_extension_info(), ap_add_output_filters_by_type(), AP_DECLARE(), asn1_table_vhost_key(), auth_ldap_post_config(), dav_build_key(), DAV_DECLARE(), dav_propdb_open(), dav_register_liveprop_namespace(), define_filter(), delete_key(), derive_codepage_from_lang(), file_cache_xlat(), find_ct(), find_entry(), find_filter_def(), hash_count_1(), hash_count_5(), hash_reset(), hash_set(), hash_traverse(), isapi_lookup(), key_space(), main(), mime_post_config(), overlay_2unique(), overlay_empty(), overlay_same(), register_one_method(), remove_items(), same_value(), and ssl_asn1_table_get().


Typedef Documentation

typedef struct apr_hash_index_t apr_hash_index_t
 

Abstract type for scanning hash tables.

Definition at line 57 of file apr_hash.h.

typedef struct apr_hash_t apr_hash_t
 

Abstract type for hash tables.

Definition at line 52 of file apr_hash.h.


Function Documentation

APR_DECLARE unsigned  int  ) 
 

Get the number of key/value pairs in the hash table.

Parameters:
ht The hash table
Returns:
The number of key/value pairs in the hash table.

Definition at line 339 of file apr_hash.c.

APR_DECLARE apr_hash_index_t  ) 
 

 int sum_values(apr_pool_t *p, apr_hash_t *ht)
 {
     apr_hash_index_t *hi;
     void *val;
     int sum = 0;
     for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) {
         apr_hash_this(hi, NULL, NULL, &val);
         sum += *(int *)val;
     }
     return sum;
 }
 

Definition at line 121 of file apr_hash.c.

References NULL.

APR_DECLARE void *   ) 
 

Look up the value associated with a key in a hash table.

Parameters:
ht The hash table
key Pointer to the key
klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
Returns:
Returns NULL if the key is not present.

Definition at line 665 of file apr_pools.c.

APR_DECLARE void   ) 
 

Associate a value with a key in a hash table.

Parameters:
ht The hash table
key Pointer to the key
klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
val Value to associate with the key
Remarks:
If the value is NULL the hash entry is deleted.

Definition at line 131 of file apr_pools.c.

APR_DECLARE apr_hash_t  ) 
 

Merge two hash tables into one new hash table. If the same key is present in both tables, call the supplied merge function to produce a merged value for the key in the new table.

Parameters:
p The pool to use for the new hash table
h1 The first of the tables to merge
h2 The second of the tables to merge
merger A callback function to merge values, or NULL to make values from h1 override values from h2 (same semantics as apr_hash_overlay())
data Client data to pass to the merger function
Returns:
A new hash table containing all of the data from the two passed in

Definition at line 263 of file apr_hash.c.

References apr_hash_t::array, apr_hash_t::count, apr_hash_t::free, apr_hash_entry_t::hash, ht, apr_hash_entry_t::key, apr_hash_entry_t::klen, max, apr_hash_t::max, apr_hash_entry_t::next, NULL, apr_hash_t::pool, and apr_hash_entry_t::val.

APR_POOL_DECLARE_ACCESSOR hash   ) 
 

Get a pointer to the pool which the hash table was created in


Variable Documentation

const apr_hash_t const apr_hash_t* base
 

Definition at line 163 of file apr_hash.h.

Referenced by APR_DECLARE(), check_code(), config_perdir_merge(), config_server_merge(), imap_handler_internal(), merge_action_dir_configs(), merge_alias_config(), merge_alias_dir_config(), merge_autoindex_configs(), merge_cache_config(), merge_cern_meta_dir_configs(), merge_cgi_config(), merge_cgid_config(), merge_charset_dir_conf(), merge_config_log_state(), merge_core_dir_configs(), merge_core_server_configs(), merge_dir_configs(), merge_ef_dir_conf(), merge_env_dir_configs(), merge_expires_dir_configs(), merge_headers_config(), merge_imap_dir_configs(), merge_info_config(), merge_isapi_dir_configs(), merge_magic_server_config(), merge_mime_dir_configs(), merge_neg_dir_configs(), merge_proxy_config(), merge_setenvif_config(), nwssl_config_server_merge(), overlay_2unique(), overlay_empty(), overlay_same(), pool_bucket_read(), set_expiration_fields(), ssl_config_perdir_merge(), ssl_config_server_merge(), and string_strtoi64().

const apr_hash_t const apr_hash_t void*(*) const void data)
 

Definition at line 188 of file apr_hash.h.

const apr_hash_t* h
 

Definition at line 74 of file apr_hash.h.

Referenced by AP_CORE_DECLARE_NONSTD(), AP_DECLARE(), AP_DECLARE_NONSTD(), APU_DECLARE(), basic_http_header(), cache_create_entity(), cache_select_url(), count_headers(), delete_key(), error_bucket_destroy(), hash(), hash_count_0(), hash_count_1(), hash_count_5(), hash_make(), hash_reset(), hash_set(), hash_traverse(), heap_bucket_destroy(), heap_bucket_read(), key_space(), log_before(), log_headers(), lookup(), main(), pass_request(), pipe_bucket_read(), register_format_tag_handler(), same_value(), socket_bucket_read(), summation_test(), test_dso_sym(), test_dso_sym_library(), test_dso_sym_return_value(), test_dso_sym_return_value_library(), test_load_library(), test_load_module(), test_load_notthere(), test_unload_library(), and test_unload_module().

const apr_hash_t* h1
 

Definition at line 180 of file apr_hash.h.

Referenced by ap_proxy_ftp_handler(), cache_select_url(), and get_canned_error_string().

const apr_hash_t const apr_hash_t* h2
 

Definition at line 180 of file apr_hash.h.

Referenced by ap_proxy_ftp_handler(), and cache_select_url().

apr_hash_t* ht
 

Definition at line 125 of file apr_hash.h.

Referenced by APR_DECLARE(), and CACHE_DECLARE().

const void** key
 

Definition at line 144 of file apr_hash.h.

const void apr_ssize_t* klen
 

Definition at line 144 of file apr_hash.h.

const apr_hash_t const apr_hash_t void*(* merger)(apr_pool_t *p, const void *key, apr_ssize_t klen, const void *h1_val, const void *h2_val, const void *data)
 

const apr_hash_t* overlay
 

Definition at line 163 of file apr_hash.h.

Referenced by overlay_2unique(), and overlay_empty().

const void apr_ssize_t void** val
 

Definition at line 144 of file apr_hash.h.