1 | #undef __DEBUG_ALLOC__
|
---|
2 | #include <malloc.h>
|
---|
3 | #include <umalloc.h>
|
---|
4 | #include <os2sel.h>
|
---|
5 |
|
---|
6 | void * _IMPORT _LNK_CONV _debug_calloc( size_t, size_t, const char *, size_t );
|
---|
7 | void _IMPORT _LNK_CONV _debug_free( void *, const char *, size_t );
|
---|
8 | void * _IMPORT _LNK_CONV _debug_malloc( size_t, const char *, size_t );
|
---|
9 | void * _IMPORT _LNK_CONV _debug_realloc( void *, size_t, const char *, size_t );
|
---|
10 | void * _IMPORT _LNK_CONV _debug_umalloc(Heap_t , size_t , const char *,size_t);
|
---|
11 | void * _IMPORT _LNK_CONV _debug_ucalloc(Heap_t , size_t, size_t ,const char *,size_t);
|
---|
12 |
|
---|
13 | void * _LNK_CONV os2calloc( size_t a, size_t b )
|
---|
14 | {
|
---|
15 | unsigned short sel = RestoreOS2FS();
|
---|
16 | void *rc;
|
---|
17 |
|
---|
18 | rc = calloc(a,b);
|
---|
19 | SetFS(sel);
|
---|
20 | return rc;
|
---|
21 | }
|
---|
22 |
|
---|
23 | void _LNK_CONV os2free( void *a )
|
---|
24 | {
|
---|
25 | unsigned short sel = RestoreOS2FS();
|
---|
26 |
|
---|
27 | free(a);
|
---|
28 | SetFS(sel);
|
---|
29 | }
|
---|
30 |
|
---|
31 | void * _LNK_CONV os2malloc( size_t a)
|
---|
32 | {
|
---|
33 | unsigned short sel = RestoreOS2FS();
|
---|
34 | void *rc;
|
---|
35 |
|
---|
36 | rc = malloc(a);
|
---|
37 | SetFS(sel);
|
---|
38 | return rc;
|
---|
39 | }
|
---|
40 |
|
---|
41 | void * _LNK_CONV os2realloc( void *a, size_t b)
|
---|
42 | {
|
---|
43 | unsigned short sel = RestoreOS2FS();
|
---|
44 | void *rc;
|
---|
45 |
|
---|
46 | rc = realloc(a, b);
|
---|
47 | SetFS(sel);
|
---|
48 | return rc;
|
---|
49 | }
|
---|
50 |
|
---|
51 | void * _LNK_CONV os2_debug_calloc( size_t a, size_t b, const char *c, size_t d)
|
---|
52 | {
|
---|
53 | unsigned short sel = RestoreOS2FS();
|
---|
54 | void *rc;
|
---|
55 |
|
---|
56 | rc = _debug_calloc(a,b,c,d);
|
---|
57 | SetFS(sel);
|
---|
58 | return rc;
|
---|
59 | }
|
---|
60 |
|
---|
61 | void _LNK_CONV os2_debug_free( void *a, const char *b, size_t c)
|
---|
62 | {
|
---|
63 | unsigned short sel = RestoreOS2FS();
|
---|
64 |
|
---|
65 | _debug_free(a,b,c);
|
---|
66 | SetFS(sel);
|
---|
67 | }
|
---|
68 |
|
---|
69 | void * _LNK_CONV os2_debug_malloc( size_t a, const char *b, size_t c)
|
---|
70 | {
|
---|
71 | unsigned short sel = RestoreOS2FS();
|
---|
72 | void *rc;
|
---|
73 |
|
---|
74 | rc = _debug_malloc(a,b,c);
|
---|
75 | SetFS(sel);
|
---|
76 | return rc;
|
---|
77 | }
|
---|
78 |
|
---|
79 | void * _LNK_CONV os2_debug_realloc( void *a, size_t b, const char *c, size_t d)
|
---|
80 | {
|
---|
81 | unsigned short sel = RestoreOS2FS();
|
---|
82 | void *rc;
|
---|
83 |
|
---|
84 | rc = _debug_realloc(a,b,c,d);
|
---|
85 | SetFS(sel);
|
---|
86 | return rc;
|
---|
87 | }
|
---|
88 |
|
---|
89 | void * _LNK_CONV os2_umalloc(Heap_t a, size_t b)
|
---|
90 | {
|
---|
91 | unsigned short sel = RestoreOS2FS();
|
---|
92 | void *rc;
|
---|
93 |
|
---|
94 | rc = _umalloc(a,b);
|
---|
95 | SetFS(sel);
|
---|
96 | return rc;
|
---|
97 | }
|
---|
98 |
|
---|
99 | void * _LNK_CONV os2_ucalloc(Heap_t a, size_t b, size_t c)
|
---|
100 | {
|
---|
101 | unsigned short sel = RestoreOS2FS();
|
---|
102 | void *rc;
|
---|
103 |
|
---|
104 | rc = _ucalloc(a,b,c);
|
---|
105 | SetFS(sel);
|
---|
106 | return rc;
|
---|
107 | }
|
---|
108 |
|
---|
109 | void * _LNK_CONV os2_debug_umalloc(Heap_t a, size_t b, const char *c, size_t d)
|
---|
110 | {
|
---|
111 | unsigned short sel = RestoreOS2FS();
|
---|
112 | void *rc;
|
---|
113 |
|
---|
114 | rc = _debug_umalloc(a,b,c,d);
|
---|
115 | SetFS(sel);
|
---|
116 | return rc;
|
---|
117 | }
|
---|
118 |
|
---|
119 | void * _LNK_CONV os2_debug_ucalloc(Heap_t a, size_t b, size_t c, const char *d, size_t e)
|
---|
120 | {
|
---|
121 | unsigned short sel = RestoreOS2FS();
|
---|
122 | void *rc;
|
---|
123 |
|
---|
124 | rc = _debug_ucalloc(a,b,c,d,e);
|
---|
125 | SetFS(sel);
|
---|
126 | return rc;
|
---|
127 | }
|
---|
128 |
|
---|