Changeset 21823 for branches/gcc-kmk/src/odincrt/malloc.cpp
- Timestamp:
- Nov 25, 2011, 10:18:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gcc-kmk/src/odincrt/malloc.cpp
r21794 r21823 5 5 */ 6 6 7 #include <odin.h> 7 8 #include <os2sel.h> 9 10 #include <memory.h> 11 12 #ifdef DEBUG 13 unsigned long nrcalls_malloc = 0; 14 unsigned long nrcalls_free = 0; 15 unsigned long totalmemalloc = 0; 16 17 // currently, it's a dumb stub 18 void _LNK_CONV getcrtstat(unsigned long *pnrcalls_malloc, 19 unsigned long *pnrcalls_free, 20 unsigned long *ptotalmemalloc) 21 { 22 *pnrcalls_malloc = nrcalls_malloc; 23 *pnrcalls_free = nrcalls_free; 24 *ptotalmemalloc = totalmemalloc; 25 } 26 #endif 8 27 9 28 extern "C" … … 11 30 12 31 // these are GCC kLIBC exports 13 void _std_malloc(size_t sz);32 void *_std_malloc(size_t sz); 14 33 void *_std_realloc(void *ptr, size_t sz); 15 34 void *_std_calloc(size_t cnt, size_t sz); 16 35 void _std_free(void *ptr); 17 36 18 void malloc(size_t sz)37 void *malloc(size_t sz) 19 38 { 20 39 unsigned short sel = RestoreOS2FS(); … … 37 56 void *ptr = _std_calloc(cnt, sz); 38 57 SetFS(sel); 39 return rc;58 return ptr; 40 59 } 41 60
Note:
See TracChangeset
for help on using the changeset viewer.