about summary refs log tree commit diff
path: root/stdlib/exit.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /stdlib/exit.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'stdlib/exit.c')
-rw-r--r--stdlib/exit.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/stdlib/exit.c b/stdlib/exit.c
index ac247a1233..bc4cb0fd08 100644
--- a/stdlib/exit.c
+++ b/stdlib/exit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,95,96,97,99,2001,02 Free Software Foundation, Inc.
+/* Copyright (C) 1991,95,96,97,99,2001,2002,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,12 +19,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <sysdep.h>
 #include "exit.h"
 
-#ifdef HAVE_GNU_LD
 #include "set-hooks.h"
 DEFINE_HOOK (__libc_atexit, (void))
-#endif
 
 
 /* Call all functions registered with `atexit' and `on_exit',
@@ -47,17 +46,33 @@ exit (int status)
 	    &__exit_funcs->fns[--__exit_funcs->idx];
 	  switch (f->flavor)
 	    {
+	      void (*atfct) (void);
+	      void (*onfct) (int status, void *arg);
+	      void (*cxafct) (void *arg, int status);
+
 	    case ef_free:
 	    case ef_us:
 	      break;
 	    case ef_on:
-	      (*f->func.on.fn) (status, f->func.on.arg);
+	      onfct = f->func.on.fn;
+#ifdef PTR_DEMANGLE
+	      PTR_DEMANGLE (onfct);
+#endif
+	      onfct (status, f->func.on.arg);
 	      break;
 	    case ef_at:
-	      (*f->func.at) ();
+	      atfct = f->func.at;
+#ifdef PTR_DEMANGLE
+	      PTR_DEMANGLE (atfct);
+#endif
+	      atfct ();
 	      break;
 	    case ef_cxa:
-	      (*f->func.cxa.fn) (f->func.cxa.arg, status);
+	      cxafct = f->func.cxa.fn;
+#ifdef PTR_DEMANGLE
+	      PTR_DEMANGLE (cxafct);
+#endif
+	      cxafct (f->func.cxa.arg, status);
 	      break;
 	    }
 	}
@@ -70,14 +85,7 @@ exit (int status)
 	free (old);
     }
 
-#ifdef	HAVE_GNU_LD
   RUN_HOOK (__libc_atexit, ());
-#else
-  {
-    extern void _cleanup (void);
-    _cleanup ();
-  }
-#endif
 
   _exit (status);
 }