comparison 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
comparison
equal deleted inserted replaced
137:768f51dd150b 138:8e6d4d96ec4c
11 #include <ngx_config.h> 11 #include <ngx_config.h>
12 #include <ngx_core.h> 12 #include <ngx_core.h>
13 13
14 14
15 typedef struct { 15 typedef struct {
16 void **buckets; 16 void *value;
17 ngx_uint_t hash_size; 17 u_char len;
18 u_char name[1];
19 } ngx_hash_elt_t;
18 20
19 ngx_uint_t max_size; 21
20 ngx_uint_t bucket_limit; 22 typedef struct {
21 size_t bucket_size; 23 ngx_hash_elt_t **buckets;
22 char *name; 24 ngx_uint_t size;
23 ngx_uint_t min_buckets;
24 } ngx_hash_t; 25 } ngx_hash_t;
25 26
26 27
27 typedef struct { 28 typedef struct {
28 ngx_uint_t hash; 29 ngx_hash_t hash;
29 ngx_str_t key; 30 void *value;
30 ngx_str_t value; 31 } ngx_hash_wildcard_t;
32
33
34 typedef struct {
35 ngx_str_t key;
36 ngx_uint_t key_hash;
37 void *value;
38 } ngx_hash_key_t;
39
40
41 typedef ngx_uint_t (*ngx_hash_key_pt) (u_char *data, size_t len);
42
43
44 typedef struct {
45 ngx_hash_t *hash;
46 ngx_hash_key_pt key;
47
48 ngx_uint_t max_size;
49 ngx_uint_t bucket_size;
50
51 char *name;
52 ngx_pool_t *pool;
53 ngx_pool_t *temp_pool;
54 } ngx_hash_init_t;
55
56
57 typedef struct {
58 void **buckets;
59 ngx_uint_t hash_size;
60
61 ngx_uint_t max_size;
62 ngx_uint_t bucket_limit;
63 size_t bucket_size;
64 char *name;
65 ngx_uint_t min_buckets;
66 } ngx_hash0_t;
67
68
69 typedef struct {
70 ngx_uint_t hash;
71 ngx_str_t key;
72 ngx_str_t value;
31 } ngx_table_elt_t; 73 } ngx_table_elt_t;
32 74
33 75
34 ngx_int_t ngx_hash_init(ngx_hash_t *hash, ngx_pool_t *pool, void *names, 76 void *ngx_hash_find(ngx_hash_t *hash, ngx_uint_t key, u_char *name, size_t len);
77 void *ngx_hash_find_wildcard(ngx_hash_wildcard_t *hwc, u_char *name,
78 size_t len);
79
80 ngx_int_t ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names,
81 ngx_uint_t nelts);
82 ngx_int_t ngx_hash_wildcard_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names,
83 ngx_uint_t nelts);
84
85 #define ngx_hash(key, c) key * 31 + c
86 ngx_uint_t ngx_hash_key(u_char *data, size_t len);
87 ngx_uint_t ngx_hash_key_lc(u_char *data, size_t len);
88
89
90 ngx_int_t ngx_hash0_init(ngx_hash0_t *hash, ngx_pool_t *pool, void *names,
35 ngx_uint_t nelts); 91 ngx_uint_t nelts);
36 92
37 93
38 #endif /* _NGX_HASH_H_INCLUDED_ */ 94 #endif /* _NGX_HASH_H_INCLUDED_ */