mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Remove __morecore and __default_morecore
Make the __morecore and __default_morecore symbols compat-only and remove their declarations from the API. Also, include morecore.c directly into malloc.c; this should ideally get merged into malloc in a future cleanup. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
@ -15,39 +15,27 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _MALLOC_INTERNAL
|
||||
# define _MALLOC_INTERNAL
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef __GNU_LIBRARY__
|
||||
# define __sbrk sbrk
|
||||
#endif
|
||||
|
||||
#ifdef __GNU_LIBRARY__
|
||||
/* It is best not to declare this and cast its result on foreign operating
|
||||
systems with potentially hostile include files. */
|
||||
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
extern void *__sbrk (ptrdiff_t increment) __THROW;
|
||||
libc_hidden_proto (__sbrk)
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#if defined(SHARED) || defined(USE_MTAG)
|
||||
static bool __always_fail_morecore = false;
|
||||
#endif
|
||||
|
||||
/* Allocate INCREMENT more bytes of data space,
|
||||
and return the start of data space, or NULL on errors.
|
||||
If INCREMENT is negative, shrink data space. */
|
||||
void *
|
||||
__default_morecore (ptrdiff_t increment)
|
||||
__glibc_morecore (ptrdiff_t increment)
|
||||
{
|
||||
#if defined(SHARED) || defined(USE_MTAG)
|
||||
if (__always_fail_morecore)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
void *result = (void *) __sbrk (increment);
|
||||
if (result == (void *) -1)
|
||||
return NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
libc_hidden_def (__default_morecore)
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
|
||||
compat_symbol (libc, __glibc_morecore, __default_morecore, GLIBC_2_0);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user