comparison src/gmalloc.c @ 54824:54395b0b6779

(__default_morecore): Use bss_sbrk(), not __sbrk(), before Cygwin unexec.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 12 Apr 2004 19:41:56 +0000
parents 695cf19ef79e
children e055d02d8b97
comparison
equal deleted inserted replaced
54823:3e88eecfd57d 54824:54395b0b6779
350 #include <malloc.h> 350 #include <malloc.h>
351 #endif 351 #endif
352 #include <errno.h> 352 #include <errno.h>
353 353
354 /* How to really get more memory. */ 354 /* How to really get more memory. */
355 #if defined(CYGWIN)
356 extern __ptr_t bss_sbrk PP ((ptrdiff_t __size));
357 extern int bss_sbrk_did_unexec;
358 #endif
355 __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore; 359 __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore;
356 360
357 /* Debugging hook for `malloc'. */ 361 /* Debugging hook for `malloc'. */
358 __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size)); 362 __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size));
359 363
1570 If INCREMENT is negative, shrink data space. */ 1574 If INCREMENT is negative, shrink data space. */
1571 __ptr_t 1575 __ptr_t
1572 __default_morecore (increment) 1576 __default_morecore (increment)
1573 __malloc_ptrdiff_t increment; 1577 __malloc_ptrdiff_t increment;
1574 { 1578 {
1575 __ptr_t result = (__ptr_t) __sbrk (increment); 1579 __ptr_t result;
1580 #if defined(CYGWIN)
1581 if (!bss_sbrk_did_unexec)
1582 {
1583 return bss_sbrk (increment);
1584 }
1585 #endif
1586 result = (__ptr_t) __sbrk (increment);
1576 if (result == (__ptr_t) -1) 1587 if (result == (__ptr_t) -1)
1577 return NULL; 1588 return NULL;
1578 return result; 1589 return result;
1579 } 1590 }
1580 /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. 1591 /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.