Reverted latest changes.
[reactos.git] / reactos / lib / msvcrt / stdlib / atexit.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/internal/atexit.h>
4
5 int
6 atexit(void (*a)(void))
7 {
8 struct __atexit *ap;
9 if (a == 0)
10 return -1;
11 ap = (struct __atexit *)malloc(sizeof(struct __atexit));
12 if (!ap)
13 return -1;
14 ap->__next = __atexit_ptr;
15 ap->__function = a;
16 __atexit_ptr = ap;
17 return 0;
18 }