27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/* when something truly should
* never happen: */
kmcond_fail_assert,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_fail,
kmkind_linear,
kmkind_heap,
kmkind_pool,
kmkind_ref,
kmkind_tree
} kmkind;
................................................................................
typedef struct kmptr {
kmkind kind;
kmshred shred;
void* ref;
} kmptr;
/* heap functions */
kmcond kmheapa (void**, sz);
kmcond kmheapao(kmptr*, sz);
kmcond kmheapf (void*);
/* generic functions */
kmcond kmfree(kmptr);
kmkind kmtell(void*);
void kmzero(void*,sz);
void kmozero(kmptr);
#ifdef __cplusplus
}
#endif
#endif
|
|
>
>
>
>
>
>
>
>
>
|
<
>
>
>
<
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/* when something truly should
* never happen: */
kmcond_fail_assert,
} kmcond;
typedef enum kmkind {
kmkind_none,
kmkind_broken,
kmkind_linear,
kmkind_heap,
kmkind_pool,
kmkind_ref,
kmkind_tree
} kmkind;
................................................................................
typedef struct kmptr {
kmkind kind;
kmshred shred;
void* ref;
} kmptr;
/* this struct is used to return both a pointer
* and an error value at the same time. */
typedef struct kmres {
kmcond cond;
union {
void* raw;
kmptr ptr;
};
} kmres;
/* heap functions */
kmres kmheapa (sz);
kmres kmheapo (sz);
kmcond kmheapf (void*);
kmres kmlina (sz);
void* kmlini (void);
/* generic functions */
kmcond kmfree(kmptr);
void kmzero(void*,sz);
void kmozero(kmptr);
#ifdef __cplusplus
}
#endif
#endif
|