scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <errno.h>
 2#include <stddef.h>
 3
 4#include "../../syscall.h"
 5
 6static char heap[16384];
 7
 8/*
 9 * TODO: Temporary solution until we implement mmap in Darwin
10 *       because it does not support any form of brk().
11 */
12void *
13_getheap(void)
14{
15	return heap;
16}
17
18int
19_brk(void *addr)
20{
21	static char *cur = heap;
22	char *p = addr;
23
24	if (p < heap || p > &heap[sizeof(heap) - 1]) {
25		errno = ENOMEM;
26		return -1;
27	}
28	cur = p;
29
30	return 0;
31}