Ignore:
Timestamp:
Nov 25, 2011, 10:18:08 PM (14 years ago)
Author:
dmik
Message:

odincrt: Actually build malloc funciton replacements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gcc-kmk/src/odincrt/malloc.cpp

    r21794 r21823  
    55 */
    66
     7#include <odin.h>
    78#include <os2sel.h>
     9
     10#include <memory.h>
     11
     12#ifdef DEBUG
     13unsigned long nrcalls_malloc = 0;
     14unsigned long nrcalls_free   = 0;
     15unsigned long totalmemalloc  = 0;
     16
     17// currently, it's a dumb stub
     18void _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
    827
    928extern "C"
     
    1130
    1231// these are GCC kLIBC exports
    13 void _std_malloc(size_t sz);
     32void *_std_malloc(size_t sz);
    1433void *_std_realloc(void *ptr, size_t sz);
    1534void *_std_calloc(size_t cnt, size_t sz);
    1635void _std_free(void *ptr);
    1736
    18 void malloc(size_t sz)
     37void *malloc(size_t sz)
    1938{
    2039    unsigned short sel = RestoreOS2FS();
     
    3756    void *ptr = _std_calloc(cnt, sz);
    3857        SetFS(sel);
    39         return rc;
     58        return ptr;
    4059}
    4160
Note: See TracChangeset for help on using the changeset viewer.