This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Reducing the size of struct _reent by not supporting on_exit()


Michael Meissner wrote:
On Thu, May 29, 2003 at 10:59:55AM +0100, Nick Clifton wrote:

Hi Jeff,

May I apply the patch below please ?

It adds a support for a new define which can be enabled in
libc/include/sys/config.h. This define suppresses support for the
on_exit() function, which can significantly reduce the size of the
_reent structure. This is important for targets with a small
address space (eg the xstormy16). The patch also uses the GCC poison pragma to stop user applications from using on_exit() if this
define has been enabled.


I would think a better tack would be a macro that changes the _fns from being:

void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */

to:

void **_fns; /* the table itself */

and then allocate it if the user ever needed on_exit functionality.  Obviously
you would have to check whether it was allocated or not.


I agree. A dynamic allocation solution makes more sense for both the function pointers and the argument list. If a user doesn't call on_exit, then there is no reason to allocate the additional area. If an application needs to use it, there is no reason to fail unconditionally. This fits in with the whole spirit of _REENT_SMALL.


-- Jeff J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]