comparison src/gmalloc.c @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 23a1cea22d13
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
3 #define _MALLOC_INTERNAL 3 #define _MALLOC_INTERNAL
4 4
5 /* The malloc headers and source files from the C library follow here. */ 5 /* The malloc headers and source files from the C library follow here. */
6 6
7 /* Declarations for `malloc' and friends. 7 /* Declarations for `malloc' and friends.
8 Copyright 1990, 91, 92, 93, 95, 96, 99 Free Software Foundation, Inc. 8 Copyright (C) 1990, 1991, 1992, 1993, 1995, 1996, 1999, 2002, 2003, 2004,
9 2005 Free Software Foundation, Inc.
9 Written May 1989 by Mike Haertel. 10 Written May 1989 by Mike Haertel.
10 11
11 This library is free software; you can redistribute it and/or 12 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public License as 13 modify it under the terms of the GNU Library General Public License as
13 published by the Free Software Foundation; either version 2 of the 14 published by the Free Software Foundation; either version 2 of the
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details. 20 Library General Public License for more details.
20 21
21 You should have received a copy of the GNU Library General Public 22 You should have received a copy of the GNU Library General Public
22 License along with this library; see the file COPYING.LIB. If 23 License along with this library; see the file COPYING.LIB. If
23 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 24 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
24 Cambridge, MA 02139, USA. 25 Fifth Floor, Boston, MA 02110-1301, USA.
25 26
26 The author may be reached (Email) at the address mike@ai.mit.edu, 27 The author may be reached (Email) at the address mike@ai.mit.edu,
27 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 28 or (US mail) as Mike Haertel c/o Free Software Foundation. */
28 29
29 #ifndef _MALLOC_H 30 #ifndef _MALLOC_H
337 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 338 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
338 Library General Public License for more details. 339 Library General Public License for more details.
339 340
340 You should have received a copy of the GNU Library General Public 341 You should have received a copy of the GNU Library General Public
341 License along with this library; see the file COPYING.LIB. If 342 License along with this library; see the file COPYING.LIB. If
342 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 343 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
343 Cambridge, MA 02139, USA. 344 Fifth Floor, Boston, MA 02110-1301, USA.
344 345
345 The author may be reached (Email) at the address mike@ai.mit.edu, 346 The author may be reached (Email) at the address mike@ai.mit.edu,
346 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 347 or (US mail) as Mike Haertel c/o Free Software Foundation. */
347 348
348 #ifndef _MALLOC_INTERNAL 349 #ifndef _MALLOC_INTERNAL
350 #include <malloc.h> 351 #include <malloc.h>
351 #endif 352 #endif
352 #include <errno.h> 353 #include <errno.h>
353 354
354 /* How to really get more memory. */ 355 /* How to really get more memory. */
356 #if defined(CYGWIN)
357 extern __ptr_t bss_sbrk PP ((ptrdiff_t __size));
358 extern int bss_sbrk_did_unexec;
359 #endif
355 __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore; 360 __ptr_t (*__morecore) PP ((ptrdiff_t __size)) = __default_morecore;
356 361
357 /* Debugging hook for `malloc'. */ 362 /* Debugging hook for `malloc'. */
358 __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size)); 363 __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size));
359 364
936 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 941 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
937 Library General Public License for more details. 942 Library General Public License for more details.
938 943
939 You should have received a copy of the GNU Library General Public 944 You should have received a copy of the GNU Library General Public
940 License along with this library; see the file COPYING.LIB. If 945 License along with this library; see the file COPYING.LIB. If
941 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 946 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
942 Cambridge, MA 02139, USA. 947 Fifth Floor, Boston, MA 02110-1301, USA.
943 948
944 The author may be reached (Email) at the address mike@ai.mit.edu, 949 The author may be reached (Email) at the address mike@ai.mit.edu,
945 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 950 or (US mail) as Mike Haertel c/o Free Software Foundation. */
946 951
947 #ifndef _MALLOC_INTERNAL 952 #ifndef _MALLOC_INTERNAL
1255 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1260 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1256 Library General Public License for more details. 1261 Library General Public License for more details.
1257 1262
1258 You should have received a copy of the GNU Library General Public 1263 You should have received a copy of the GNU Library General Public
1259 License along with this library; see the file COPYING.LIB. If 1264 License along with this library; see the file COPYING.LIB. If
1260 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 1265 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1261 Cambridge, MA 02139, USA. 1266 Fifth Floor, Boston, MA 02110-1301, USA.
1262 1267
1263 The author may be reached (Email) at the address mike@ai.mit.edu, 1268 The author may be reached (Email) at the address mike@ai.mit.edu,
1264 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 1269 or (US mail) as Mike Haertel c/o Free Software Foundation. */
1265 1270
1266 #ifndef _MALLOC_INTERNAL 1271 #ifndef _MALLOC_INTERNAL
1500 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1505 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1501 Library General Public License for more details. 1506 Library General Public License for more details.
1502 1507
1503 You should have received a copy of the GNU Library General Public 1508 You should have received a copy of the GNU Library General Public
1504 License along with this library; see the file COPYING.LIB. If 1509 License along with this library; see the file COPYING.LIB. If
1505 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 1510 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1506 Cambridge, MA 02139, USA. 1511 Fifth Floor, Boston, MA 02110-1301, USA.
1507 1512
1508 The author may be reached (Email) at the address mike@ai.mit.edu, 1513 The author may be reached (Email) at the address mike@ai.mit.edu,
1509 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 1514 or (US mail) as Mike Haertel c/o Free Software Foundation. */
1510 1515
1511 #ifndef _MALLOC_INTERNAL 1516 #ifndef _MALLOC_INTERNAL
1540 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1545 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1541 GNU General Public License for more details. 1546 GNU General Public License for more details.
1542 1547
1543 You should have received a copy of the GNU General Public License 1548 You should have received a copy of the GNU General Public License
1544 along with the GNU C Library; see the file COPYING. If not, write to 1549 along with the GNU C Library; see the file COPYING. If not, write to
1545 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 1550 the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
1551 MA 02110-1301, USA. */
1546 1552
1547 #ifndef _MALLOC_INTERNAL 1553 #ifndef _MALLOC_INTERNAL
1548 #define _MALLOC_INTERNAL 1554 #define _MALLOC_INTERNAL
1549 #include <malloc.h> 1555 #include <malloc.h>
1550 #endif 1556 #endif
1570 If INCREMENT is negative, shrink data space. */ 1576 If INCREMENT is negative, shrink data space. */
1571 __ptr_t 1577 __ptr_t
1572 __default_morecore (increment) 1578 __default_morecore (increment)
1573 __malloc_ptrdiff_t increment; 1579 __malloc_ptrdiff_t increment;
1574 { 1580 {
1575 __ptr_t result = (__ptr_t) __sbrk (increment); 1581 __ptr_t result;
1582 #if defined(CYGWIN)
1583 if (!bss_sbrk_did_unexec)
1584 {
1585 return bss_sbrk (increment);
1586 }
1587 #endif
1588 result = (__ptr_t) __sbrk (increment);
1576 if (result == (__ptr_t) -1) 1589 if (result == (__ptr_t) -1)
1577 return NULL; 1590 return NULL;
1578 return result; 1591 return result;
1579 } 1592 }
1580 /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. 1593 /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
1589 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1602 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1590 Library General Public License for more details. 1603 Library General Public License for more details.
1591 1604
1592 You should have received a copy of the GNU Library General Public 1605 You should have received a copy of the GNU Library General Public
1593 License along with this library; see the file COPYING.LIB. If 1606 License along with this library; see the file COPYING.LIB. If
1594 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 1607 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1595 Cambridge, MA 02139, USA. */ 1608 Fifth Floor, Boston, MA 02110-1301, USA. */
1596 1609
1597 #ifndef _MALLOC_INTERNAL 1610 #ifndef _MALLOC_INTERNAL
1598 #define _MALLOC_INTERNAL 1611 #define _MALLOC_INTERNAL
1599 #include <malloc.h> 1612 #include <malloc.h>
1600 #endif 1613 #endif
1689 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1702 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1690 Library General Public License for more details. 1703 Library General Public License for more details.
1691 1704
1692 You should have received a copy of the GNU Library General Public 1705 You should have received a copy of the GNU Library General Public
1693 License along with this library; see the file COPYING.LIB. If 1706 License along with this library; see the file COPYING.LIB. If
1694 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 1707 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1695 Cambridge, MA 02139, USA. 1708 Fifth Floor, Boston, MA 02110-1301, USA.
1696 1709
1697 The author may be reached (Email) at the address mike@ai.mit.edu, 1710 The author may be reached (Email) at the address mike@ai.mit.edu,
1698 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 1711 or (US mail) as Mike Haertel c/o Free Software Foundation. */
1699 1712
1700 #if defined (_MALLOC_INTERNAL) && defined (GMALLOC_INHIBIT_VALLOC) 1713 #if defined (_MALLOC_INTERNAL) && defined (GMALLOC_INHIBIT_VALLOC)
1756 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1769 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1757 Library General Public License for more details. 1770 Library General Public License for more details.
1758 1771
1759 You should have received a copy of the GNU Library General Public 1772 You should have received a copy of the GNU Library General Public
1760 License along with this library; see the file COPYING.LIB. If 1773 License along with this library; see the file COPYING.LIB. If
1761 not, write to the Free Software Foundation, Inc., 675 Mass Ave, 1774 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
1762 Cambridge, MA 02139, USA. 1775 Fifth Floor, Boston, MA 02110-1301, USA.
1763 1776
1764 The author may be reached (Email) at the address mike@ai.mit.edu, 1777 The author may be reached (Email) at the address mike@ai.mit.edu,
1765 or (US mail) as Mike Haertel c/o Free Software Foundation. */ 1778 or (US mail) as Mike Haertel c/o Free Software Foundation. */
1766 1779
1767 #ifdef emacs 1780 #ifdef emacs
1976 { 1989 {
1977 return mcheck_used ? checkhdr (ptr) : MCHECK_DISABLED; 1990 return mcheck_used ? checkhdr (ptr) : MCHECK_DISABLED;
1978 } 1991 }
1979 1992
1980 #endif /* GC_MCHECK */ 1993 #endif /* GC_MCHECK */
1994
1995 /* arch-tag: 93dce5c0-f49a-41b5-86b1-f91c4169c02e
1996 (do not change this comment) */