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
|
#ifdef __cplusplus
extern "C" {
#endif
typedef enum kmcond {
kmcond_ok,
kmcond_bad_address,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_heap,
kmkind_pool,
kmkind_ref,
kmkind_tree
} kmkind;
typedef enum kmshred {
kmshred_yes,
kmshred_no
} kmshred;
typedef struct kmcell {
kmkind kind;
sz size;
kmshred shred;
sz refs;
struct kmcell* src;
} kmcell;
typedef struct kmptr {
kmkind kind;
kmshred shred;
void* ref;
kmcell* cell;
} kmptr;
/* heap functions */
void* kmheapa(sz);
kmcond kmheapf(void*);
#ifdef __cplusplus
}
#endif
#endif
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
<
>
>
>
>
>
>
>
>
>
|
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#ifdef __cplusplus
extern "C" {
#endif
typedef enum kmcond {
kmcond_ok,
kmcond_unnecessary,
kmcond_fail,
kmcond_unhandled,
kmcond_mismatch,
kmcond_bad_address,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_fail,
kmkind_linear,
kmkind_heap,
kmkind_pool,
kmkind_ref,
kmkind_tree
} kmkind;
typedef enum kmshred {
kmshred_yes,
kmshred_no
} kmshred;
typedef struct kmbox {
kmkind kind;
sz size;
kmshred shred;
} kmbox;
typedef struct kmcell {
kmbox header;
sz refs;
struct kmcell* src;
} kmcell;
typedef struct kmnode {
kmbox header;
struct kmnode* origin,
* branch,
* next,
* prev;
} kmnode;
typedef struct kmptr {
kmkind kind;
kmshred shred;
void* ref;
} kmptr;
/* heap functions */
void* kmheapa(sz);
kmptr kmheapao(sz);
kmcond kmheapf(void*);
/* generic functions */
kmcond kmfree(kmptr);
kmkind kmtell(void*);
void kmzero(void*,sz);
void kmozero(kmptr);
#ifdef __cplusplus
}
#endif
#endif
|