diff options
author | Mark Mitchell <mark@codesourcery.com> | 2006-03-21 00:57:34 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2006-03-21 00:57:34 +0000 |
commit | 3078fb4f360e44b436bafcd9e7c51f26792e34b4 (patch) | |
tree | 73dd0a205a2e36fad8a6f952171248396769b97c /newlib/libc/stdlib | |
parent | c1494e03a2374c5841e7b53e0a97a3af7438cc76 (diff) | |
download | cygnal-3078fb4f360e44b436bafcd9e7c51f26792e34b4.tar.gz cygnal-3078fb4f360e44b436bafcd9e7c51f26792e34b4.tar.bz2 cygnal-3078fb4f360e44b436bafcd9e7c51f26792e34b4.zip |
* acconfig.h (_ATEXIT_DYNAMIC_ALLOC): Undef.
* configure.in (--disable-newlib-atexit-dynamic-alloc): New
option.
* configure: Regenerated.
* newlib.hin: Regenerated.
* libc/stdlib/__atexit.c (__register_exitproc): Don't call malloc
if _ATEXIT_DYNAMIC_ALLOC is undefined.
* libc/stdlib/__call_atexit.c (__call_exitprocs): Don't call free
if _ATEXIT_DYNAMIC_ALLOC is undefined.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r-- | newlib/libc/stdlib/__atexit.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdlib/__call_atexit.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c index 04f494738..49eebb37e 100644 --- a/newlib/libc/stdlib/__atexit.c +++ b/newlib/libc/stdlib/__atexit.c @@ -35,6 +35,9 @@ _DEFUN (__register_exitproc, _GLOBAL_REENT->_atexit = p = &_GLOBAL_REENT->_atexit0; if (p->_ind >= _ATEXIT_SIZE) { +#ifndef _ATEXIT_DYNAMIC_ALLOC + return -1; +#else p = (struct _atexit *) malloc (sizeof *p); if (p == NULL) { @@ -50,6 +53,7 @@ _DEFUN (__register_exitproc, p->_on_exit_args._fntypes = 0; p->_on_exit_args._is_cxa = 0; #endif +#endif } if (type != __et_atexit) diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c index cea569ff4..6fa398ae2 100644 --- a/newlib/libc/stdlib/__call_atexit.c +++ b/newlib/libc/stdlib/__call_atexit.c @@ -61,6 +61,9 @@ _DEFUN (__call_exitprocs, (code, d), (*((void (*)(_PTR)) fn))(args->_fnargs[n]); } +#ifndef _ATEXIT_DYNAMIC_ALLOC + break; +#else /* Move to the next block. Free empty blocks except the last one, which is part of _GLOBAL_REENT. */ if (p->_ind == 0 && p->_next) @@ -79,5 +82,6 @@ _DEFUN (__call_exitprocs, (code, d), lastp = &p->_next; p = p->_next; } +#endif } } |