File: hash.h

package info (click to toggle)
rxp 1.1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 416 kB
  • ctags: 899
  • sloc: ansic: 8,784; makefile: 102; sh: 3
file content (27 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* 
 * Copyright Richard Tobin 1995-9.
 */

#ifndef HASH_H
#define HASH_H

typedef struct hash_entry {
    void *key;
    int key_len;
    void *value;
    struct hash_entry *next;
} HashEntryStruct;

typedef HashEntryStruct *HashEntry;
typedef struct hash_table *HashTable;

HashTable create_hash_table(int init_size);
void free_hash_table(HashTable table);
HashEntry hash_find(HashTable table, const void *key, int key_len);
HashEntry hash_find_or_add(HashTable table, const void *key, int key_len, int *foundp);
void hash_remove(HashTable table, HashEntry entry);
void hash_map(HashTable table, 
	      void (*function)(const HashEntryStruct *, void *), void *arg);
int hash_count(HashTable table);

#endif /* HASH_H */