Ignore:
Timestamp:
Apr 10, 2003, 12:28:07 PM (22 years ago)
Author:
sandervl
Message:

PF: MSVCRT update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/msvcrt/heap.c

    r9633 r10005  
    2323
    2424#include "msvcrt.h"
     25
     26#include <string.h>
     27
    2528#include "ms_errno.h"
    2629
     
    4346static int MSVCRT_new_mode;
    4447
    45 
    4648/*********************************************************************
    4749 *              ??2@YAPAXI@Z (MSVCRT.@)
     
    5052{
    5153  void *retval = HeapAlloc(GetProcessHeap(), 0, size);
    52   TRACE("(%ld) returning %p\n", size, retval);
     54  TRACE("MSVCRT: operator_new (%ld) returning %p\n", size, retval);
    5355  LOCK_HEAP;
    5456  if(!retval && MSVCRT_new_handler)
     
    6365void MSVCRT_operator_delete(void *mem)
    6466{
    65   TRACE("(%p)\n", mem);
     67  TRACE("MSVCRT: operator_delete (%p)\n", mem);
    6668  HeapFree(GetProcessHeap(), 0, mem);
    6769}
     
    7375MSVCRT_new_handler_func MSVCRT__query_new_handler(void)
    7476{
     77  dprintf(("MSVCRT: _query_new_handler"));
    7578  return MSVCRT_new_handler;
    7679}
     
    8285int MSVCRT__query_new_mode(void)
    8386{
     87  dprintf(("MSVCRT: _query_new_mode"));
    8488  return MSVCRT_new_mode;
    8589}
     
    9195{
    9296  MSVCRT_new_handler_func old_handler;
     97
     98  dprintf(("MSVCRT: _set_new_mode"));
     99
    93100  LOCK_HEAP;
    94101  old_handler = MSVCRT_new_handler;
     
    103110MSVCRT_new_handler_func MSVCRT_set_new_handler(void *func)
    104111{
    105   TRACE("(%p)\n",func);
     112  TRACE("MSVCRT: set_new_handler (%p)\n",func);
    106113  MSVCRT__set_new_handler(NULL);
    107114  return NULL;
     
    114121{
    115122  int old_mode;
     123  TRACE("MSVCRT: set_new_mode (%d)\n",mode);
    116124  LOCK_HEAP;
    117125  old_mode = MSVCRT_new_mode;
     
    126134int _callnewh(unsigned long size)
    127135{
     136  TRACE("MSVCRT: _callnewh (%d)\n",size);
    128137  if(MSVCRT_new_handler)
    129138    (*MSVCRT_new_handler)(size);
     
    136145void* _expand(void* mem, MSVCRT_size_t size)
    137146{
     147  TRACE("MSVCRT: _expand (%p)\n",mem);
    138148  return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, mem, size);
    139149}
     
    142152 *              _heapchk (MSVCRT.@)
    143153 */
    144 int _heapchk(void)
    145 {
     154int MSVCRT__heapchk(void)
     155{
     156  TRACE("MSVCRT: _heapchk");
    146157  if (!HeapValidate( GetProcessHeap(), 0, NULL))
    147158  {
     
    155166 *              _heapmin (MSVCRT.@)
    156167 */
    157 int _heapmin(void)
    158 {
     168int MSVCRT__heapmin(void)
     169{
     170  TRACE("MSVCRT: _heapmin");
    159171  if (!HeapCompact( GetProcessHeap(), 0 ))
    160172  {
     
    169181 *              _heapwalk (MSVCRT.@)
    170182 */
    171 int _heapwalk(_HEAPINFO* next)
     183int MSVCRT__heapwalk(_HEAPINFO* next)
    172184{
    173185  PROCESS_HEAP_ENTRY phe;
     186
     187  TRACE("MSVCRT: _heapwalk");
    174188
    175189  LOCK_HEAP;
     
    210224 *              _heapset (MSVCRT.@)
    211225 */
    212 int _heapset(unsigned int value)
     226int MSVCRT__heapset(unsigned int value)
    213227{
    214228  int retval;
    215229  _HEAPINFO heap;
    216230
     231  TRACE("MSVCRT: _heapset");
     232
    217233  memset( &heap, 0, sizeof(_HEAPINFO) );
    218234  LOCK_HEAP;
    219   while ((retval = _heapwalk(&heap)) == _HEAPOK)
     235  while ((retval = MSVCRT__heapwalk(&heap)) == _HEAPOK)
    220236  {
    221237    if (heap._useflag == _FREEENTRY)
     
    229245 *              _heapadd (MSVCRT.@)
    230246 */
    231 int _heapadd(void* mem, MSVCRT_size_t size)
    232 {
    233   TRACE("(%p,%d) unsupported in Win32\n", mem,size);
     247int MSVCRT__heapadd(void* mem, MSVCRT_size_t size)
     248{
     249  TRACE("MSVCRT: _heapadd (%p,%d) unsupported in Win32\n", mem,size);
    234250  *MSVCRT__errno() = MSVCRT_ENOSYS;
    235251  return -1;
     
    239255 *              _msize (MSVCRT.@)
    240256 */
    241 MSVCRT_size_t _msize(void* mem)
     257MSVCRT_size_t MSVCRT__msize(void* mem)
    242258{
    243259  long size = HeapSize(GetProcessHeap(),0,mem);
     260
     261  TRACE("MSVCRT: _msize (%p)",mem);
     262
    244263  if (size == -1)
    245264  {
     
    255274void* MSVCRT_calloc(MSVCRT_size_t size, MSVCRT_size_t count)
    256275{
    257   return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size * count );
     276  void *ret;
     277  ret = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size * count );
     278  TRACE("MSVCRT: calloc (%d,%d) returned %p",size, count, ret);
     279  return ret;
    258280}
    259281
     
    263285void MSVCRT_free(void* ptr)
    264286{
    265   dprintf(("MSVCRT_free %x ptr",ptr));
     287  dprintf(("MSVCRT: free %x ptr",ptr));
    266288  HeapFree(GetProcessHeap(),0,ptr);
    267289}
     
    269291void* MSVCRT(memset)(void* ptr,int fill,MSVCRT(size_t) size)
    270292{
    271   dprintf(("MSVCRT_memset %x(%d bytes) with %d",ptr,size,fill));
     293  dprintf(("MSVCRT: memset %x(%d bytes) with %d",ptr,size,fill));
    272294  return memset(ptr,fill,size);
    273295}
     
    276298void* MSVCRT(memcpy)(void* ptr,const void* ptr2,MSVCRT(size_t) size)
    277299{
    278   dprintf(("MSVCRT_memcpy %x->%x (%d bytes)",ptr2,ptr,size));
     300  dprintf(("MSVCRT: memcpy %x->%x (%d bytes)",ptr2,ptr,size));
    279301  return memcpy(ptr,ptr2,size);
    280302}
     
    287309{
    288310  void *ret = HeapAlloc(GetProcessHeap(),0,size);
    289   dprintf(("MSVCRT_malloc of %d size returned %x",size,ret));
     311  dprintf(("MSVCRT: malloc of %d size returned %x",size,ret));
    290312  if (!ret)
    291313    MSVCRT__set_errno(GetLastError());
     
    298320void* MSVCRT_realloc(void* ptr, MSVCRT_size_t size)
    299321{
    300   dprintf(("MSVCRT_realloc %x",ptr));
     322  dprintf(("MSVCRT: realloc %x",ptr));
    301323  return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
    302324}
Note: See TracChangeset for help on using the changeset viewer.