Changeset 3f777ae09119907584a10343cd298226cb78b79a
- Timestamp:
- 09/08/11 14:37:55
(2 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1315492675 -0400
- git-parent:
[4ace564f33d37b3d293284f7261dfd478027df90]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1315492675 -0400
- Message:
support creating hashes with larger initial sizes
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r48a51fb |
r3f777ae |
|
| 107 | 107 | } |
|---|
| 108 | 108 | |
|---|
| | 109 | void noit_hash_init_size(noit_hash_table *h, int size) { |
|---|
| | 110 | memset(h, 0, sizeof(noit_hash_table)); |
|---|
| | 111 | h->initval = lrand48(); |
|---|
| | 112 | h->table_size = size; |
|---|
| | 113 | h->buckets = calloc(h->table_size, sizeof(noit_hash_bucket *)); |
|---|
| | 114 | } |
|---|
| | 115 | |
|---|
| 109 | 116 | noit_hash_bucket *noit_hash__new_bucket(const char *k, int klen, void *data) { |
|---|
| 110 | 117 | noit_hash_bucket *b; |
|---|
| r6210da7 |
r3f777ae |
|
| 67 | 67 | |
|---|
| 68 | 68 | void noit_hash_init(noit_hash_table *h); |
|---|
| | 69 | void noit_hash_init_size(noit_hash_table *h, int size); |
|---|
| 69 | 70 | /* NOTE! "k" and "data" MUST NOT be transient buffers, as the hash table |
|---|
| 70 | 71 | * implementation does not duplicate them. You provide a pair of |
|---|