|
From: <ea...@us...> - 2002-06-13 22:02:21
|
Update of /cvsroot/mingw/msys/rt/src/newlib/libc/stdlib
In directory usw-pr-cvs1:/tmp/cvs-serv19899/libc/stdlib
Modified Files:
mallocr.c
Log Message:
* libc/stdlib/mallocr.c: Merge changes from official newlib.
Index: mallocr.c
===================================================================
RCS file: /cvsroot/mingw/msys/rt/src/newlib/libc/stdlib/mallocr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** mallocr.c 15 Oct 2001 22:22:32 -0000 1.3
--- mallocr.c 13 Jun 2002 22:02:17 -0000 1.4
***************
*** 305,309 ****
#define MALLOC_UNLOCK __malloc_unlock(reent_ptr)
! #if defined(__CYGWIN__) || defined(__MSYS__)
# undef _WIN32
# undef WIN32
--- 305,309 ----
#define MALLOC_UNLOCK __malloc_unlock(reent_ptr)
! #ifdef __CYGWIN__
# undef _WIN32
# undef WIN32
***************
*** 2129,2132 ****
--- 2129,2133 ----
INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of sbrked space */
INTERNAL_SIZE_T correction; /* bytes for 2nd sbrk call */
+ int correction_failed = 0; /* whether we should relax the assertion */
char* new_brk; /* return of 2nd sbrk call */
INTERNAL_SIZE_T top_size; /* new size of top chunk */
***************
*** 2153,2161 ****
if (brk == (char*)(MORECORE_FAILURE) ||
(brk < old_end && old_top != initial_top))
! return;
sbrked_mem += sbrk_size;
! if (brk == old_end) /* can just add bytes to current top */
{
top_size = sbrk_size + old_top_size;
--- 2154,2164 ----
if (brk == (char*)(MORECORE_FAILURE) ||
(brk < old_end && old_top != initial_top))
! return;
sbrked_mem += sbrk_size;
! if (brk == old_end /* can just add bytes to current top, unless
! previous correction failed */
! && ((POINTER_UINT)old_end & (pagesz - 1)) == 0)
{
top_size = sbrk_size + old_top_size;
***************
*** 2184,2188 ****
/* Allocate correction */
new_brk = (char*)(MORECORE (correction));
! if (new_brk == (char*)(MORECORE_FAILURE)) return;
sbrked_mem += correction;
--- 2187,2196 ----
/* Allocate correction */
new_brk = (char*)(MORECORE (correction));
! if (new_brk == (char*)(MORECORE_FAILURE))
! {
! correction = 0;
! correction_failed = 1;
! new_brk = brk;
! }
sbrked_mem += correction;
***************
*** 2229,2233 ****
/* We always land on a page boundary */
! assert(((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0);
}
--- 2237,2242 ----
/* We always land on a page boundary */
! assert(((unsigned long)((char*)top + top_size) & (pagesz - 1)) == 0
! || correction_failed);
}
***************
*** 3204,3208 ****
#endif /* DEFINE_CALLOC */
! #if defined(DEFINE_CFREE) && !defined(__CYGWIN__) && !defined(__MSYS__)
/*
--- 3213,3217 ----
#endif /* DEFINE_CALLOC */
! #if defined(DEFINE_CFREE) && !(defined(__CYGWIN__)||defined(__MSYS__))
/*
***************
*** 3463,3466 ****
--- 3472,3476 ----
#ifdef INTERNAL_NEWLIB
+ _REENT_SMALL_CHECK_INIT(_stderr_r (reent_ptr));
fp = _stderr_r(reent_ptr);
#define fprintf fiprintf
|