Don't use malloc, pessimize to use sbrk.

fix sbrk manpage while we're at it.
This commit is contained in:
phk 1996-09-27 15:34:19 +00:00
parent 860717e26f
commit 331ec6879b
2 changed files with 3 additions and 2 deletions

View File

@ -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;

View File

@ -39,7 +39,7 @@
.Nm sbrk
.Nd change data segment size
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/unistd.h>
.Ft int
.Fn brk "const char *addr"
.Ft char *