1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17: 18: 19:
20:
21: #include "libtk.h"
22:
23: #ifndef KMALLOCTEST
24:
25: EXPORT void* Kmalloc( size_t size )
26: {
27: void *p;
28:
29: MEMLOCK( return NULL )
30: p = _mem_malloc(size, &_Kmacb);
31: MEMUNLOCK()
32:
33: return p;
34: }
35:
36: EXPORT void* Kcalloc( size_t nmemb, size_t size )
37: {
38: void *p;
39:
40: MEMLOCK( return NULL )
41: p = _mem_calloc(nmemb, size, &_Kmacb);
42: MEMUNLOCK()
43:
44: return p;
45: }
46:
47: EXPORT void* Krealloc( void *ptr, size_t size )
48: {
49: void *p;
50:
51: MEMLOCK( return NULL )
52: p = _mem_realloc(ptr, size, &_Kmacb);
53: MEMUNLOCK()
54:
55: return p;
56: }
57:
58: EXPORT void Kfree( void *ptr )
59: {
60: MEMLOCK( return )
61: _mem_free(ptr, &_Kmacb);
62: MEMUNLOCK()
63: }
64:
65: #else
66:
67: EXPORT void Kmalloctest( int mode )
68: {
69: MEMLOCK( return )
70: _mem_malloctest(mode, &_Kmacb);
71: MEMUNLOCK()
72: }
73:
74: EXPORT BOOL Kmalloccheck( void *ptr )
75: {
76: BOOL v;
77:
78: MEMLOCK( return FALSE )
79: v = _mem_malloccheck(ptr, &_Kmacb);
80: MEMUNLOCK()
81:
82: return v;
83: }
84:
85: #endif