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