File: stdhashc.h

package info (click to toggle)
maqview 0.2.5-9
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,076 kB
  • sloc: ansic: 13,310; cpp: 1,295; java: 178; perl: 116; sh: 41; makefile: 23
file content (60 lines) | stat: -rw-r--r-- 1,200 bytes parent folder | download | duplicates (6)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef STDHASHC_H
#define STDHASHC_H

#include <sys/types.h>

/* hashci */

typedef struct
{
	void *ptr;
} hashci_t;

typedef int (*hashci_f)(const char *key, int value);

#ifdef __cplusplus
extern "C" {
#endif

	hashci_t *hci_init();
	void hci_destroy(hashci_t *h);
	int hci_put(hashci_t *h, const char *key, int value);
	int hci_del(hashci_t *h, const char *key);
    int hci_get(const hashci_t *h, const char *key, int *value);
	u_int32_t hci_size(hashci_t *h);
	u_int32_t hci_capacity(hashci_t *h);
	int hci_resize(hashci_t *h, u_int32_t new_size);
	void hci_traverse(hashci_t *h, hashci_f func);

#ifdef __cplusplus
}
#endif

/* hashii */

typedef struct
{
	void *ptr;
} hashii_t;

typedef int (*hashii_f)(u_int32_t key, int value);

#ifdef __cplusplus
extern "C" {
#endif

	hashii_t *hii_init();
	void hii_destroy(hashii_t *h);
	int hii_put(hashii_t *h, u_int32_t key, int value);
	int hii_del(hashii_t *h, u_int32_t key);
    int hii_get(const hashii_t *h, u_int32_t key, int *value);
	u_int32_t hii_size(hashii_t *h);
	u_int32_t hii_capacity(hashii_t *h);
	int hii_resize(hashii_t *h, u_int32_t new_size);
	void hii_traverse(hashii_t *h, hashii_f func);

#ifdef __cplusplus
}
#endif

#endif