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 SMALLOCTEST
24:
25: EXPORT void* Smalloc( size_t size )
26: {
27: void *p;
28:
29: MEMLOCK( return NULL )
30: p = _mem_malloc(size, &_Smacb);
31: MEMUNLOCK()
32:
33: return p;
34: }
35:
36: EXPORT void* Scalloc( size_t nmemb, size_t size )
37: {
38: void *p;
39:
40: MEMLOCK( return NULL )
41: p = _mem_calloc(nmemb, size, &_Smacb);
42: MEMUNLOCK()
43:
44: return p;
45: }
46:
47: EXPORT void* Srealloc( void *ptr, size_t size )
48: {
49: void *p;
50:
51: MEMLOCK( return NULL )
52: p = _mem_realloc(ptr, size, &_Smacb);
53: MEMUNLOCK()
54:
55: return p;
56: }
57:
58: EXPORT void Sfree( void *ptr )
59: {
60: MEMLOCK( return )
61: _mem_free(ptr, &_Smacb);
62: MEMUNLOCK()
63: }
64:
65: #else
66:
67: EXPORT void Smalloctest( int mode )
68: {
69: MEMLOCK( return )
70: _mem_malloctest(mode, &_Smacb);
71: MEMUNLOCK()
72: }
73:
74: EXPORT BOOL Smalloccheck( void *ptr )
75: {
76: BOOL v;
77:
78: MEMLOCK( return FALSE )
79: v = _mem_malloccheck(ptr, &_Smacb);
80: MEMUNLOCK()
81:
82: return v;
83: }
84:
85: #endif