ReactOS  0.4.14-dev-77-gd9e7c48
heap.c
Go to the documentation of this file.
1 /*
2  * msvcrt.dll heap functions
3  *
4  * Copyright 2000 Jon Griffiths
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  * Note: Win32 heap operations are MT safe. We only lock the new
21  * handler and non atomic heap operations
22  */
23 
24 #include <precomp.h>
25 #include <malloc.h>
26 
27 /* MT */
28 #define LOCK_HEAP _mlock( _HEAP_LOCK )
29 #define UNLOCK_HEAP _munlock( _HEAP_LOCK )
30 
31 /* _aligned */
32 #define SAVED_PTR(x) ((void *)((DWORD_PTR)((char *)x - sizeof(void *)) & \
33  ~(sizeof(void *) - 1)))
34 #define ALIGN_PTR(ptr, alignment, offset) ((void *) \
35  ((((DWORD_PTR)((char *)ptr + alignment + sizeof(void *) + offset)) & \
36  ~(alignment - 1)) - offset))
37 
38 
40 
42 static int MSVCRT_new_mode;
43 
44 /* FIXME - According to documentation it should be 8*1024, at runtime it returns 16 */
45 static unsigned int MSVCRT_amblksiz = 16;
46 /* FIXME - According to documentation it should be 480 bytes, at runtime default is 0 */
47 static size_t MSVCRT_sbh_threshold = 0;
48 
49 /*********************************************************************
50  * ??2@YAPAXI@Z (MSVCRT.@)
51  */
53 {
54  void *retval;
55  int freed;
56 
57  do
58  {
59  retval = HeapAlloc(GetProcessHeap(), 0, size);
60  if(retval)
61  {
62  TRACE("(%ld) returning %p\n", size, retval);
63  return retval;
64  }
65 
66  LOCK_HEAP;
68  freed = (*MSVCRT_new_handler)(size);
69  else
70  freed = 0;
72  } while(freed);
73 
74  TRACE("(%ld) out of memory\n", size);
75  return NULL;
76 }
77 
78 
79 /*********************************************************************
80  * ??2@YAPAXIHPBDH@Z (MSVCRT.@)
81  */
82 void* CDECL MSVCRT_operator_new_dbg(size_t size, int type, const char *file, int line)
83 {
84  return MSVCRT_operator_new( size );
85 }
86 
87 
88 /*********************************************************************
89  * ??3@YAXPAX@Z (MSVCRT.@)
90  */
92 {
93  TRACE("(%p)\n", mem);
95 }
96 
97 
98 /*********************************************************************
99  * ?_query_new_handler@@YAP6AHI@ZXZ (MSVCRT.@)
100  */
102 {
103  return MSVCRT_new_handler;
104 }
105 
106 
107 /*********************************************************************
108  * ?_query_new_mode@@YAHXZ (MSVCRT.@)
109  */
111 {
112  return MSVCRT_new_mode;
113 }
114 
115 /*********************************************************************
116  * ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z (MSVCRT.@)
117  */
119 {
120  MSVCRT_new_handler_func old_handler;
121  LOCK_HEAP;
122  old_handler = MSVCRT_new_handler;
124  UNLOCK_HEAP;
125  return old_handler;
126 }
127 
128 /*********************************************************************
129  * ?set_new_handler@@YAP6AXXZP6AXXZ@Z (MSVCRT.@)
130  */
132 {
133  TRACE("(%p)\n",func);
135  return NULL;
136 }
137 
138 /*********************************************************************
139  * ?_set_new_mode@@YAHH@Z (MSVCRT.@)
140  */
142 {
143  int old_mode;
144  LOCK_HEAP;
145  old_mode = MSVCRT_new_mode;
147  UNLOCK_HEAP;
148  return old_mode;
149 }
150 
151 /*********************************************************************
152  * _callnewh (MSVCRT.@)
153  */
154 int CDECL _callnewh(size_t size)
155 {
157  (*MSVCRT_new_handler)(size);
158  return 0;
159 }
160 
161 /*********************************************************************
162  * _expand (MSVCRT.@)
163  */
164 void* CDECL _expand(void* mem, size_t size)
165 {
167 }
168 
169 /*********************************************************************
170  * _heapchk (MSVCRT.@)
171  */
172 int CDECL _heapchk(void)
173 {
174  if (!HeapValidate( GetProcessHeap(), 0, NULL))
175  {
177  return _HEAPBADNODE;
178  }
179  return _HEAPOK;
180 }
181 
182 /*********************************************************************
183  * _heapmin (MSVCRT.@)
184  */
185 int CDECL _heapmin(void)
186 {
187  if (!HeapCompact( GetProcessHeap(), 0 ))
188  {
191  return -1;
192  }
193  return 0;
194 }
195 
196 /*********************************************************************
197  * _heapwalk (MSVCRT.@)
198  */
200 {
201  PROCESS_HEAP_ENTRY phe;
202 
203  LOCK_HEAP;
204  phe.lpData = next->_pentry;
205  phe.cbData = (DWORD)next->_size;
206  phe.wFlags = next->_useflag == _USEDENTRY ? PROCESS_HEAP_ENTRY_BUSY : 0;
207 
208  if (phe.lpData && phe.wFlags & PROCESS_HEAP_ENTRY_BUSY &&
209  !HeapValidate( GetProcessHeap(), 0, phe.lpData ))
210  {
211  UNLOCK_HEAP;
213  return _HEAPBADNODE;
214  }
215 
216  do
217  {
218  if (!HeapWalk( GetProcessHeap(), &phe ))
219  {
220  UNLOCK_HEAP;
222  return _HEAPEND;
224  if (!phe.lpData)
225  return _HEAPBADBEGIN;
226  return _HEAPBADNODE;
227  }
229 
230  UNLOCK_HEAP;
231  next->_pentry = phe.lpData;
232  next->_size = phe.cbData;
234  return _HEAPOK;
235 }
236 
237 /*********************************************************************
238  * _heapset (MSVCRT.@)
239  */
240 int CDECL _heapset(unsigned int value)
241 {
242  int retval;
243  _HEAPINFO heap;
244 
245  memset( &heap, 0, sizeof(heap) );
246  LOCK_HEAP;
247  while ((retval = _heapwalk(&heap)) == _HEAPOK)
248  {
249  if (heap._useflag == _FREEENTRY)
250  memset(heap._pentry, value, heap._size);
251  }
252  UNLOCK_HEAP;
253  return retval == _HEAPEND? _HEAPOK : retval;
254 }
255 
256 /*********************************************************************
257  * _heapadd (MSVCRT.@)
258  */
259 int CDECL _heapadd(void* mem, size_t size)
260 {
261  TRACE("(%p,%ld) unsupported in Win32\n", mem,size);
262  *_errno() = ENOSYS;
263  return -1;
264 }
265 
266 /*********************************************************************
267  * _heapadd (MSVCRT.@)
268  */
270 {
271  return (intptr_t)GetProcessHeap();
272 }
273 
274 /*********************************************************************
275  * _msize (MSVCRT.@)
276  */
277 size_t CDECL _msize(void* mem)
278 {
279  size_t size = HeapSize(GetProcessHeap(),0,mem);
280  if (size == ~(size_t)0)
281  {
282  WARN(":Probably called with non wine-allocated memory, ret = -1\n");
283  /* At least the Win32 crtdll/msvcrt also return -1 in this case */
284  }
285  return size;
286 }
287 
288 /*********************************************************************
289  * calloc (MSVCRT.@)
290  */
291 void* CDECL calloc(size_t count, size_t size)
292 {
294 }
295 
296 /*********************************************************************
297  * free (MSVCRT.@)
298  */
299 void CDECL free(void* ptr)
300 {
301  if(ptr == NULL) return;
303 }
304 
305 /*********************************************************************
306  * malloc (MSVCRT.@)
307  */
308 void* CDECL malloc(size_t size)
309 {
310  void *ret = HeapAlloc(GetProcessHeap(),0,size);
311  if (!ret)
312  *_errno() = ENOMEM;
313  return ret;
314 }
315 
316 /*********************************************************************
317  * realloc (MSVCRT.@)
318  */
319 void* CDECL realloc(void* ptr, size_t size)
320 {
321  if (!ptr) return malloc(size);
322  if (size) return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
323  free(ptr);
324  return NULL;
325 }
326 
327 /*********************************************************************
328  * __p__amblksiz (MSVCRT.@)
329  */
330 unsigned int* CDECL __p__amblksiz(void)
331 {
332  return &MSVCRT_amblksiz;
333 }
334 
335 /*********************************************************************
336  * _get_sbh_threshold (MSVCRT.@)
337  */
339 {
340  return MSVCRT_sbh_threshold;
341 }
342 
343 /*********************************************************************
344  * _set_sbh_threshold (MSVCRT.@)
345  */
346 int CDECL _set_sbh_threshold(size_t threshold)
347 {
348  if(threshold > 1016)
349  return 0;
350  else
351  MSVCRT_sbh_threshold = threshold;
352  return 1;
353 }
354 
355 /*********************************************************************
356  * _aligned_free (MSVCRT.@)
357  */
358 void CDECL _aligned_free(void *memblock)
359 {
360  TRACE("(%p)\n", memblock);
361 
362  if (memblock)
363  {
364  void **saved = SAVED_PTR(memblock);
365  free(*saved);
366  }
367 }
368 
369 /*********************************************************************
370  * _aligned_offset_malloc (MSVCRT.@)
371  */
372 void * CDECL _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
373 {
374  void *memblock, *temp, **saved;
375  TRACE("(%lu, %lu, %lu)\n", size, alignment, offset);
376 
377  /* alignment must be a power of 2 */
378  if ((alignment & (alignment - 1)) != 0)
379  {
380  *_errno() = EINVAL;
381  return NULL;
382  }
383 
384  /* offset must be less than size */
385  if (offset >= size)
386  {
387  *_errno() = EINVAL;
388  return NULL;
389  }
390 
391  /* don't align to less than void pointer size */
392  if (alignment < sizeof(void *))
393  alignment = sizeof(void *);
394 
395  /* allocate enough space for void pointer and alignment */
396  temp = malloc(size + alignment + sizeof(void *));
397 
398  if (!temp)
399  return NULL;
400 
401  /* adjust pointer for proper alignment and offset */
402  memblock = ALIGN_PTR(temp, alignment, offset);
403 
404  /* Save the real allocation address below returned address */
405  /* so it can be found later to free. */
406  saved = SAVED_PTR(memblock);
407  *saved = temp;
408 
409  return memblock;
410 }
411 
412 /*********************************************************************
413  * _aligned_malloc (MSVCRT.@)
414  */
415 void * CDECL _aligned_malloc(size_t size, size_t alignment)
416 {
417  TRACE("(%lu, %lu)\n", size, alignment);
418  return _aligned_offset_malloc(size, alignment, 0);
419 }
420 
421 /*********************************************************************
422  * _aligned_offset_realloc (MSVCRT.@)
423  */
424 void * CDECL _aligned_offset_realloc(void *memblock, size_t size,
425  size_t alignment, size_t offset)
426 {
427  void * temp, **saved;
428  size_t old_padding, new_padding, old_size;
429  TRACE("(%p, %lu, %lu, %lu)\n", memblock, size, alignment, offset);
430 
431  if (!memblock)
432  return _aligned_offset_malloc(size, alignment, offset);
433 
434  /* alignment must be a power of 2 */
435  if ((alignment & (alignment - 1)) != 0)
436  {
437  *_errno() = EINVAL;
438  return NULL;
439  }
440 
441  /* offset must be less than size */
442  if (offset >= size)
443  {
444  *_errno() = EINVAL;
445  return NULL;
446  }
447 
448  if (size == 0)
449  {
450  _aligned_free(memblock);
451  return NULL;
452  }
453 
454  /* don't align to less than void pointer size */
455  if (alignment < sizeof(void *))
456  alignment = sizeof(void *);
457 
458  /* make sure alignment and offset didn't change */
459  saved = SAVED_PTR(memblock);
460  if (memblock != ALIGN_PTR(*saved, alignment, offset))
461  {
462  *_errno() = EINVAL;
463  return NULL;
464  }
465 
466  old_padding = (char *)memblock - (char *)*saved;
467 
468  /* Get previous size of block */
469  old_size = _msize(*saved);
470  if (old_size == -1)
471  {
472  /* It seems this function was called with an invalid pointer. Bail out. */
473  return NULL;
474  }
475 
476  /* Adjust old_size to get amount of actual data in old block. */
477  if (old_size < old_padding)
478  {
479  /* Shouldn't happen. Something's weird, so bail out. */
480  return NULL;
481  }
482  old_size -= old_padding;
483 
484  temp = realloc(*saved, size + alignment + sizeof(void *));
485 
486  if (!temp)
487  return NULL;
488 
489  /* adjust pointer for proper alignment and offset */
490  memblock = ALIGN_PTR(temp, alignment, offset);
491 
492  /* Save the real allocation address below returned address */
493  /* so it can be found later to free. */
494  saved = SAVED_PTR(memblock);
495 
496  new_padding = (char *)memblock - (char *)temp;
497 
498 /*
499  Memory layout of old block is as follows:
500  +-------+---------------------+-+--------------------------+-----------+
501  | ... | "old_padding" bytes | | ... "old_size" bytes ... | ... |
502  +-------+---------------------+-+--------------------------+-----------+
503  ^ ^ ^
504  | | |
505  *saved saved memblock
506 
507  Memory layout of new block is as follows:
508  +-------+-----------------------------+-+----------------------+-------+
509  | ... | "new_padding" bytes | | ... "size" bytes ... | ... |
510  +-------+-----------------------------+-+----------------------+-------+
511  ^ ^ ^
512  | | |
513  temp saved memblock
514 
515  However, in the new block, actual data is still written as follows
516  (because it was copied by MSVCRT_realloc):
517  +-------+---------------------+--------------------------------+-------+
518  | ... | "old_padding" bytes | ... "old_size" bytes ... | ... |
519  +-------+---------------------+--------------------------------+-------+
520  ^ ^ ^
521  | | |
522  temp saved memblock
523 
524  Therefore, min(old_size,size) bytes of actual data have to be moved
525  from the offset they were at in the old block (temp + old_padding),
526  to the offset they have to be in the new block (temp + new_padding == memblock).
527 */
528  if (new_padding != old_padding)
529  memmove((char *)memblock, (char *)temp + old_padding, (old_size < size) ? old_size : size);
530 
531  *saved = temp;
532 
533  return memblock;
534 }
535 
536 /*********************************************************************
537  * _aligned_realloc (MSVCRT.@)
538  */
539 void * CDECL _aligned_realloc(void *memblock, size_t size, size_t alignment)
540 {
541  TRACE("(%p, %lu, %lu)\n", memblock, size, alignment);
542  return _aligned_offset_realloc(memblock, size, alignment, 0);
543 }
544 
545 /*********************************************************************
546  * memmove_s (MSVCRT.@)
547  */
548 int CDECL memmove_s(void *dest, size_t numberOfElements, const void *src, size_t count)
549 {
550  TRACE("(%p %lu %p %lu)\n", dest, numberOfElements, src, count);
551 
552  if(!count)
553  return 0;
554 
555  if(!dest || !src) {
556  if(dest)
558 
559  *_errno() = EINVAL;
560  return EINVAL;
561  }
562 
563  if(count > numberOfElements) {
565 
566  *_errno() = ERANGE;
567  return ERANGE;
568  }
569 
570  memmove(dest, src, count);
571  return 0;
572 }
573 
574 /*********************************************************************
575  * strncpy_s (MSVCRT.@)
576  */
578  const char *src, size_t count)
579 {
580  size_t i, end;
581 
582  TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count);
583 
584  if(!count)
585  return 0;
586 
587  if (!MSVCRT_CHECK_PMT(dest != NULL) || !MSVCRT_CHECK_PMT(src != NULL) ||
589  *_errno() = EINVAL;
590  return EINVAL;
591  }
592 
594  end = count;
595  else
596  end = numberOfElements-1;
597 
598  for(i=0; i<end && src[i]; i++)
599  dest[i] = src[i];
600 
601  if(!src[i] || end==count || count==_TRUNCATE) {
602  dest[i] = '\0';
603  return 0;
604  }
605 
606  MSVCRT_INVALID_PMT("dest[numberOfElements] is too small", EINVAL);
607  dest[0] = '\0';
608  return EINVAL;
609 }
GLenum func
Definition: glext.h:6028
void CDECL free(void *ptr)
Definition: heap.c:299
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define PROCESS_HEAP_UNCOMMITTED_RANGE
Definition: winbase.h:332
#define _HEAPBADBEGIN
Definition: malloc.h:34
Definition: arc.h:39
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define _FREEENTRY
Definition: malloc.h:40
#define WARN(fmt,...)
Definition: debug.h:111
GLintptr offset
Definition: glext.h:5920
int CDECL _heapadd(void *mem, size_t size)
Definition: heap.c:259
void *CDECL realloc(void *ptr, size_t size)
Definition: heap.c:319
static unsigned int MSVCRT_amblksiz
Definition: heap.c:45
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int CDECL _heapchk(void)
Definition: heap.c:172
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
Definition: heapmem.c:156
void *CDECL MSVCRT_operator_new(size_t size)
Definition: heap.c:52
GLuint GLuint end
Definition: gl.h:1545
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
#define DWORD
Definition: nt_native.h:44
void *CDECL _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
Definition: heap.c:372
Definition: arc.h:48
static size_t numberOfElements
Definition: string.c:87
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void *CDECL malloc(size_t size)
Definition: heap.c:308
#define ALIGN_PTR(ptr, alignment, offset)
Definition: heap.c:34
#define PROCESS_HEAP_REGION
Definition: winbase.h:331
size_t _size
Definition: malloc.h:48
static PVOID ptr
Definition: dispmode.c:27
void *CDECL MSVCRT_operator_new_dbg(size_t size, int type, const char *file, int line)
Definition: heap.c:82
#define MSVCRT_INVALID_PMT(x)
Definition: mbstowcs_s.c:25
smooth NULL
Definition: ftsmooth.c:416
void *CDECL _expand(void *mem, size_t size)
Definition: heap.c:164
Definition: parser.c:48
#define _HEAPEND
Definition: malloc.h:36
static int MSVCRT_new_mode
Definition: heap.c:42
#define SAVED_PTR(x)
Definition: heap.c:32
#define _TRUNCATE
Definition: crtdefs.h:241
#define PROCESS_HEAP_ENTRY_BUSY
Definition: winbase.h:333
BOOL WINAPI HeapWalk(HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry)
Definition: heapmem.c:291
void *CDECL _aligned_offset_realloc(void *memblock, size_t size, size_t alignment, size_t offset)
Definition: heap.c:424
MSVCRT_new_handler_func CDECL MSVCRT__query_new_handler(void)
Definition: heap.c:101
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define ENOSYS
Definition: errno.h:45
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
int intptr_t
Definition: crtdefs.h:283
DWORD cbData
Definition: winbase.h:1223
int(CDECL * MSVCRT_new_handler_func)(size_t size)
Definition: heap.c:39
#define LOCK_HEAP
Definition: heap.c:28
int CDECL MSVCRT__set_new_mode(int mode)
Definition: heap.c:141
void *CDECL _aligned_malloc(size_t size, size_t alignment)
Definition: heap.c:415
void *CDECL _aligned_realloc(void *memblock, size_t size, size_t alignment)
Definition: heap.c:539
int CDECL _callnewh(size_t size)
Definition: heap.c:154
int _useflag
Definition: malloc.h:49
_CRTIMP int *__cdecl _errno(void)
Definition: errno.c:19
void CDECL _aligned_free(void *memblock)
Definition: heap.c:358
#define ERANGE
Definition: acclib.h:92
int ret
unsigned int *CDECL __p__amblksiz(void)
Definition: heap.c:330
#define MSVCRT_CHECK_PMT(x)
Definition: mbstowcs_s.c:26
int CDECL memmove_s(void *dest, size_t numberOfElements, const void *src, size_t count)
Definition: heap.c:548
SIZE_T WINAPI HeapCompact(HANDLE hHeap, DWORD dwFlags)
Definition: heapmem.c:145
GLenum src
Definition: glext.h:6340
Definition: winbase.h:1221
static MSVCRT_new_handler_func MSVCRT_new_handler
Definition: heap.c:41
GLenum mode
Definition: glext.h:6217
void _dosmaperr(unsigned long oserrcode)
Definition: errno.c:81
intptr_t CDECL _get_heap_handle(void)
Definition: heap.c:269
int CDECL strncpy_s(char *dest, size_t numberOfElements, const char *src, size_t count)
Definition: heap.c:577
size_t CDECL _get_sbh_threshold(void)
Definition: heap.c:338
int CDECL _heapwalk(_HEAPINFO *next)
Definition: heap.c:199
static unsigned __int64 next
Definition: rand_nt.c:6
int CDECL _set_sbh_threshold(size_t threshold)
Definition: heap.c:346
int CDECL MSVCRT__query_new_mode(void)
Definition: heap.c:110
#define CDECL
Definition: compat.h:21
static calc_node_t temp
Definition: rpn_ieee.c:38
#define _USEDENTRY
Definition: malloc.h:41
#define _HEAPBADNODE
Definition: malloc.h:35
#define UNLOCK_HEAP
Definition: heap.c:29
MSVCRT_new_handler_func CDECL MSVCRT_set_new_handler(void *func)
Definition: heap.c:131
size_t CDECL _msize(void *mem)
Definition: heap.c:277
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define _HEAPOK
Definition: malloc.h:33
void *CDECL calloc(size_t count, size_t size)
Definition: heap.c:291
Definition: mem.c:156
int * _pentry
Definition: malloc.h:47
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static char * dest
Definition: rtl.c:135
static size_t MSVCRT_sbh_threshold
Definition: heap.c:47
WORD wFlags
Definition: winbase.h:1226
#define memset(x, y, z)
Definition: compat.h:39
int CDECL _heapmin(void)
Definition: heap.c:185
PVOID lpData
Definition: winbase.h:1222
MSVCRT_new_handler_func CDECL MSVCRT__set_new_handler(MSVCRT_new_handler_func func)
Definition: heap.c:118
#define HEAP_REALLOC_IN_PLACE_ONLY
Definition: nt_native.h:1696
#define HeapFree(x, y, z)
Definition: compat.h:394
int CDECL _heapset(unsigned int value)
Definition: heap.c:240
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
void CDECL MSVCRT_operator_delete(void *mem)
Definition: heap.c:91
Definition: fci.c:126