Don't use malloc, pessimize to use sbrk.
fix sbrk manpage while we're at it.
This commit is contained in:
parent
860717e26f
commit
331ec6879b
@ -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;
|
||||
|
@ -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 *
|
||||
|
Loading…
x
Reference in New Issue
Block a user