comparison src/gmalloc.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 3d3049ae1304
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
22 Therefore, there is no need to consult the abominable STDC_HEADERS flag. 22 Therefore, there is no need to consult the abominable STDC_HEADERS flag.
23 -- jwz 23 -- jwz
24 */ 24 */
25 # define STDC_HEADERS 25 # define STDC_HEADERS
26 #endif 26 #endif
27
28 #define __const const
29 27
30 28
31 /* DO NOT EDIT THIS FILE -- it is automagically generated. -*- C -*- */ 29 /* DO NOT EDIT THIS FILE -- it is automagically generated. -*- C -*- */
32 /* Bwaa-haa-haa! Not a chance that this is actually true! */ 30 /* Bwaa-haa-haa! Not a chance that this is actually true! */
33 31
271 /* Pick up the current statistics. */ 269 /* Pick up the current statistics. */
272 extern struct mstats mstats __P ((void)); 270 extern struct mstats mstats __P ((void));
273 271
274 /* Call WARNFUN with a warning message when memory usage is high. */ 272 /* Call WARNFUN with a warning message when memory usage is high. */
275 extern void memory_warnings __P ((__ptr_t __start, 273 extern void memory_warnings __P ((__ptr_t __start,
276 void (*__warnfun) __P ((__const char *)))); 274 void (*__warnfun) __P ((const char *))));
277 275
278 276
279 #if 0 /* unused in this file, and conflicting prototypes anyway */ 277 #if 0 /* unused in this file, and conflicting prototypes anyway */
280 /* Relocating allocator. */ 278 /* Relocating allocator. */
281 279
367 #define _MALLOC_INTERNAL 365 #define _MALLOC_INTERNAL
368 #include <malloc.h> 366 #include <malloc.h>
369 #endif 367 #endif
370 368
371 /* How to really get more memory. */ 369 /* How to really get more memory. */
372 #ifdef HEAP_IN_DATA 370 #if defined (HEAP_IN_DATA) && !defined(PDUMP)
373 /* once dumped, free() & realloc() on static heap space will fail */ 371 /* once dumped, free() & realloc() on static heap space will fail */
374 #define PURE_DATA(x) \ 372 #define PURE_DATA(x) \
375 ((static_heap_dumped && (char*)x >= static_heap_base \ 373 ((static_heap_dumped && (char*)x >= static_heap_base \
376 && (char*)x <= (static_heap_base + static_heap_size) ) ? 1 : 0) 374 && (char*)x <= (static_heap_base + static_heap_size) ) ? 1 : 0)
377 extern int initialized; 375 extern int initialized;
446 /* Set everything up and remember that we have. */ 444 /* Set everything up and remember that we have. */
447 static int initialize __P ((void)); 445 static int initialize __P ((void));
448 static int 446 static int
449 initialize () 447 initialize ()
450 { 448 {
451 #ifdef HEAP_IN_DATA 449 #if defined (HEAP_IN_DATA) && !defined(PDUMP)
452 if (static_heap_dumped && __morecore == more_static_core) 450 if (static_heap_dumped && __morecore == more_static_core)
453 { 451 {
454 __morecore = __default_morecore; 452 __morecore = __default_morecore;
455 } 453 }
456 #endif 454 #endif
1036 { 1034 {
1037 __ptr_t result; 1035 __ptr_t result;
1038 int type; 1036 int type;
1039 __malloc_size_t block, blocks, oldlimit; 1037 __malloc_size_t block, blocks, oldlimit;
1040 1038
1041 if (PURE_DATA(ptr)) 1039 if (PURE_DATA (ptr))
1042 { 1040 {
1043 result = malloc (size); 1041 result = malloc (size);
1044 memcpy(result, ptr, size); 1042 memcpy(result, ptr, size);
1045 return result; 1043 return result;
1046 } 1044 }