diff src/core/ngx_hash.h @ 138:8e6d4d96ec4c NGINX_0_3_16

nginx 0.3.16 *) Feature: the ngx_http_map_module. *) Feature: the "types_hash_max_size" and "types_hash_bucket_size" directives. *) Feature: the "ssi_value_length" directive. *) Feature: the "worker_rlimit_core" directive. *) Workaround: the connection number in logs was always 1 if nginx was built by the icc 8.1 or 9.0 compilers with optimization for Pentium 4. *) Bugfix: the "config timefmt" SSI command set incorrect time format. *) Bugfix: nginx did not close connection to IMAP/POP3 backend for the SSL connections; bug appeared in 0.3.13. Thanks to Rob Mueller. *) Bugfix: segmentation fault may occurred in at SSL shutdown; bug appeared in 0.3.13.
author Igor Sysoev <http://sysoev.ru>
date Fri, 16 Dec 2005 00:00:00 +0300
parents b55cbf18157e
children 84910468f6de
line wrap: on
line diff
--- a/src/core/ngx_hash.h
+++ b/src/core/ngx_hash.h
@@ -13,25 +13,81 @@
 
 
 typedef struct {
-    void        **buckets;
-    ngx_uint_t    hash_size;
+    void             *value;
+    u_char            len;
+    u_char            name[1];
+} ngx_hash_elt_t;
 
-    ngx_uint_t    max_size;
-    ngx_uint_t    bucket_limit;
-    size_t        bucket_size;
-    char         *name;
-    ngx_uint_t    min_buckets;
+
+typedef struct {
+    ngx_hash_elt_t  **buckets;
+    ngx_uint_t        size;
 } ngx_hash_t;
 
 
 typedef struct {
-    ngx_uint_t  hash;
-    ngx_str_t   key;
-    ngx_str_t   value;
+    ngx_hash_t        hash;
+    void             *value;
+} ngx_hash_wildcard_t;
+
+
+typedef struct {
+    ngx_str_t         key;
+    ngx_uint_t        key_hash;
+    void             *value;
+} ngx_hash_key_t;
+
+
+typedef ngx_uint_t (*ngx_hash_key_pt) (u_char *data, size_t len);
+
+
+typedef struct {
+    ngx_hash_t       *hash;
+    ngx_hash_key_pt   key;
+
+    ngx_uint_t        max_size;
+    ngx_uint_t        bucket_size;
+
+    char             *name;
+    ngx_pool_t       *pool;
+    ngx_pool_t       *temp_pool;
+} ngx_hash_init_t;
+
+
+typedef struct {
+    void            **buckets;
+    ngx_uint_t        hash_size;
+
+    ngx_uint_t        max_size;
+    ngx_uint_t        bucket_limit;
+    size_t            bucket_size;
+    char             *name;
+    ngx_uint_t        min_buckets;
+} ngx_hash0_t;
+
+
+typedef struct {
+    ngx_uint_t        hash;
+    ngx_str_t         key;
+    ngx_str_t         value;
 } ngx_table_elt_t;
 
 
-ngx_int_t ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names,
+void *ngx_hash_find(ngx_hash_t *hash, ngx_uint_t key, u_char *name, size_t len);
+void *ngx_hash_find_wildcard(ngx_hash_wildcard_t *hwc, u_char *name,
+    size_t len);
+
+ngx_int_t ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names,
+    ngx_uint_t nelts);
+ngx_int_t ngx_hash_wildcard_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names,
+    ngx_uint_t nelts);
+
+#define ngx_hash(key, c)   key * 31 + c
+ngx_uint_t ngx_hash_key(u_char *data, size_t len);
+ngx_uint_t ngx_hash_key_lc(u_char *data, size_t len);
+
+
+ngx_int_t ngx_hash0_init(ngx_hash0_t *hash, ngx_pool_t *pool, void *names,
     ngx_uint_t nelts);