Changeset 10005 for trunk/src/msvcrt/heap.c
- Timestamp:
- Apr 10, 2003, 12:28:07 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msvcrt/heap.c
r9633 r10005 23 23 24 24 #include "msvcrt.h" 25 26 #include <string.h> 27 25 28 #include "ms_errno.h" 26 29 … … 43 46 static int MSVCRT_new_mode; 44 47 45 46 48 /********************************************************************* 47 49 * ??2@YAPAXI@Z (MSVCRT.@) … … 50 52 { 51 53 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); 53 55 LOCK_HEAP; 54 56 if(!retval && MSVCRT_new_handler) … … 63 65 void MSVCRT_operator_delete(void *mem) 64 66 { 65 TRACE(" (%p)\n", mem);67 TRACE("MSVCRT: operator_delete (%p)\n", mem); 66 68 HeapFree(GetProcessHeap(), 0, mem); 67 69 } … … 73 75 MSVCRT_new_handler_func MSVCRT__query_new_handler(void) 74 76 { 77 dprintf(("MSVCRT: _query_new_handler")); 75 78 return MSVCRT_new_handler; 76 79 } … … 82 85 int MSVCRT__query_new_mode(void) 83 86 { 87 dprintf(("MSVCRT: _query_new_mode")); 84 88 return MSVCRT_new_mode; 85 89 } … … 91 95 { 92 96 MSVCRT_new_handler_func old_handler; 97 98 dprintf(("MSVCRT: _set_new_mode")); 99 93 100 LOCK_HEAP; 94 101 old_handler = MSVCRT_new_handler; … … 103 110 MSVCRT_new_handler_func MSVCRT_set_new_handler(void *func) 104 111 { 105 TRACE(" (%p)\n",func);112 TRACE("MSVCRT: set_new_handler (%p)\n",func); 106 113 MSVCRT__set_new_handler(NULL); 107 114 return NULL; … … 114 121 { 115 122 int old_mode; 123 TRACE("MSVCRT: set_new_mode (%d)\n",mode); 116 124 LOCK_HEAP; 117 125 old_mode = MSVCRT_new_mode; … … 126 134 int _callnewh(unsigned long size) 127 135 { 136 TRACE("MSVCRT: _callnewh (%d)\n",size); 128 137 if(MSVCRT_new_handler) 129 138 (*MSVCRT_new_handler)(size); … … 136 145 void* _expand(void* mem, MSVCRT_size_t size) 137 146 { 147 TRACE("MSVCRT: _expand (%p)\n",mem); 138 148 return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, mem, size); 139 149 } … … 142 152 * _heapchk (MSVCRT.@) 143 153 */ 144 int _heapchk(void) 145 { 154 int MSVCRT__heapchk(void) 155 { 156 TRACE("MSVCRT: _heapchk"); 146 157 if (!HeapValidate( GetProcessHeap(), 0, NULL)) 147 158 { … … 155 166 * _heapmin (MSVCRT.@) 156 167 */ 157 int _heapmin(void) 158 { 168 int MSVCRT__heapmin(void) 169 { 170 TRACE("MSVCRT: _heapmin"); 159 171 if (!HeapCompact( GetProcessHeap(), 0 )) 160 172 { … … 169 181 * _heapwalk (MSVCRT.@) 170 182 */ 171 int _heapwalk(_HEAPINFO* next)183 int MSVCRT__heapwalk(_HEAPINFO* next) 172 184 { 173 185 PROCESS_HEAP_ENTRY phe; 186 187 TRACE("MSVCRT: _heapwalk"); 174 188 175 189 LOCK_HEAP; … … 210 224 * _heapset (MSVCRT.@) 211 225 */ 212 int _heapset(unsigned int value)226 int MSVCRT__heapset(unsigned int value) 213 227 { 214 228 int retval; 215 229 _HEAPINFO heap; 216 230 231 TRACE("MSVCRT: _heapset"); 232 217 233 memset( &heap, 0, sizeof(_HEAPINFO) ); 218 234 LOCK_HEAP; 219 while ((retval = _heapwalk(&heap)) == _HEAPOK)235 while ((retval = MSVCRT__heapwalk(&heap)) == _HEAPOK) 220 236 { 221 237 if (heap._useflag == _FREEENTRY) … … 229 245 * _heapadd (MSVCRT.@) 230 246 */ 231 int _heapadd(void* mem, MSVCRT_size_t size)232 { 233 TRACE(" (%p,%d) unsupported in Win32\n", mem,size);247 int MSVCRT__heapadd(void* mem, MSVCRT_size_t size) 248 { 249 TRACE("MSVCRT: _heapadd (%p,%d) unsupported in Win32\n", mem,size); 234 250 *MSVCRT__errno() = MSVCRT_ENOSYS; 235 251 return -1; … … 239 255 * _msize (MSVCRT.@) 240 256 */ 241 MSVCRT_size_t _msize(void* mem)257 MSVCRT_size_t MSVCRT__msize(void* mem) 242 258 { 243 259 long size = HeapSize(GetProcessHeap(),0,mem); 260 261 TRACE("MSVCRT: _msize (%p)",mem); 262 244 263 if (size == -1) 245 264 { … … 255 274 void* MSVCRT_calloc(MSVCRT_size_t size, MSVCRT_size_t count) 256 275 { 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; 258 280 } 259 281 … … 263 285 void MSVCRT_free(void* ptr) 264 286 { 265 dprintf(("MSVCRT _free %x ptr",ptr));287 dprintf(("MSVCRT: free %x ptr",ptr)); 266 288 HeapFree(GetProcessHeap(),0,ptr); 267 289 } … … 269 291 void* MSVCRT(memset)(void* ptr,int fill,MSVCRT(size_t) size) 270 292 { 271 dprintf(("MSVCRT _memset %x(%d bytes) with %d",ptr,size,fill));293 dprintf(("MSVCRT: memset %x(%d bytes) with %d",ptr,size,fill)); 272 294 return memset(ptr,fill,size); 273 295 } … … 276 298 void* MSVCRT(memcpy)(void* ptr,const void* ptr2,MSVCRT(size_t) size) 277 299 { 278 dprintf(("MSVCRT _memcpy %x->%x (%d bytes)",ptr2,ptr,size));300 dprintf(("MSVCRT: memcpy %x->%x (%d bytes)",ptr2,ptr,size)); 279 301 return memcpy(ptr,ptr2,size); 280 302 } … … 287 309 { 288 310 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)); 290 312 if (!ret) 291 313 MSVCRT__set_errno(GetLastError()); … … 298 320 void* MSVCRT_realloc(void* ptr, MSVCRT_size_t size) 299 321 { 300 dprintf(("MSVCRT _realloc %x",ptr));322 dprintf(("MSVCRT: realloc %x",ptr)); 301 323 return HeapReAlloc(GetProcessHeap(), 0, ptr, size); 302 324 }
Note:
See TracChangeset
for help on using the changeset viewer.