Start adding a new hash implementation. the new code is basically that
that the net stack used but works in a different way than the existing code, and has proved useful in the modules code where it cured the strange segfaults that were being produced in seemingly random and unpredictable places. the naming could be improved :) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@321 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0c1eef852d
commit
45fcd51d6a
@ -5,6 +5,40 @@
|
||||
#ifndef _KERNEL_KHASH_H
|
||||
#define _KERNEL_KHASH_H
|
||||
|
||||
#include <pools.h>
|
||||
|
||||
typedef struct hash_entry hash_entry;
|
||||
typedef struct new_hash_table new_hash_table;
|
||||
typedef struct hash_index hash_index;
|
||||
|
||||
struct hash_entry {
|
||||
hash_entry *next;
|
||||
int hash;
|
||||
const void *key;
|
||||
ssize_t klen;
|
||||
const void *val;
|
||||
};
|
||||
|
||||
struct hash_index {
|
||||
new_hash_table *nh;
|
||||
hash_entry *this_idx;
|
||||
hash_entry *next;
|
||||
int index;
|
||||
};
|
||||
|
||||
struct new_hash_table {
|
||||
hash_entry **array;
|
||||
hash_index iterator;
|
||||
int count;
|
||||
int max;
|
||||
struct pool_ctl *pool;
|
||||
};
|
||||
|
||||
new_hash_table *hash_make(void);
|
||||
void *hash_get(new_hash_table *, const void *, ssize_t);
|
||||
void hash_set(new_hash_table *, const void *, ssize_t , const void *);
|
||||
|
||||
|
||||
struct hash_iterator {
|
||||
void *ptr;
|
||||
int bucket;
|
||||
|
Loading…
x
Reference in New Issue
Block a user