summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/atexit.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-09-27 15:34:19 +0000
committerphk <phk@FreeBSD.org>1996-09-27 15:34:19 +0000
commit331ec6879be6807dad9f67efa5906b3f1881198e (patch)
treef92fb4ef7ba1f62f56f27d9dfef70a656991b81e /lib/libc/stdlib/atexit.c
parent860717e26f90d179bbd29bb4b6ea6ddfc1c304ba (diff)
downloadFreeBSD-src-331ec6879be6807dad9f67efa5906b3f1881198e.zip
FreeBSD-src-331ec6879be6807dad9f67efa5906b3f1881198e.tar.gz
Don't use malloc, pessimize to use sbrk.
fix sbrk manpage while we're at it.
Diffstat (limited to 'lib/libc/stdlib/atexit.c')
-rw-r--r--lib/libc/stdlib/atexit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index 9c4caed..ea2a7e2 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -40,6 +40,7 @@ static char sccsid[] = "@(#)atexit.c 8.1 (Berkeley) 6/4/93";
#include <stddef.h>
#include <stdlib.h>
+#include <unistd.h>
#include "atexit.h"
/*
@@ -55,7 +56,7 @@ atexit(fn)
if ((p = __atexit) == NULL)
__atexit = p = &__atexit0;
else if (p->ind >= ATEXIT_SIZE) {
- if ((p = malloc(sizeof(*p))) == NULL)
+ if ((p = (struct atexit *)sbrk(sizeof(*p))) == (struct atexit *)-1)
return (-1);
p->ind = 0;
p->next = __atexit;
OpenPOWER on IntegriCloud