From 867df8dda093c409f6f2b86e568aca243a103f12 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Wed, 17 Jan 2001 17:42:06 +0000 Subject: Note about need to match _SC_ATEXIT_MAX. Minor macro name change. --- libc/stdlib/atexit.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'libc/stdlib/atexit.c') diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index 20195fa96..5079692af 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -15,7 +15,12 @@ #include /* ATEXIT.H */ -#define MAXONEXIT 20 /* AIUI Posix requires 10 */ + +/* + * NOTE!!! The following should match the value returned by + * by sysconf(_SC_ATEXIT_MAX) in unistd/sysconf.c + */ +#define MAXATEXIT 20 /* AIUI Posix requires 10 */ typedef void (*vfuncp) (void); @@ -23,7 +28,7 @@ extern vfuncp __cleanup; extern void __do_exit(); extern void _exit __P((int __status)) __attribute__ ((__noreturn__)); -extern vfuncp __atexit_table[MAXONEXIT]; +extern vfuncp __atexit_table[MAXATEXIT]; extern int __atexit_count; /* End ATEXIT.H */ @@ -31,7 +36,7 @@ extern int __atexit_count; #ifdef L_atexit int atexit(vfuncp ptr) { - if ((__atexit_count < 0) || (__atexit_count >= MAXONEXIT)) { + if ((__atexit_count < 0) || (__atexit_count >= MAXATEXIT)) { errno = ENOMEM; return -1; } @@ -42,7 +47,7 @@ int atexit(vfuncp ptr) return 0; } -vfuncp __atexit_table[MAXONEXIT]; +vfuncp __atexit_table[MAXATEXIT]; int __atexit_count = 0; void __do_exit(int rv) -- cgit v1.2.3