15 lines
259 B
C
15 lines
259 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#include "newmem.h"
|
||
|
|
||
|
void* newmalloc(size_t size) {
|
||
|
void* start = sbrk(0);
|
||
|
void* finish = sbrk(size);
|
||
|
|
||
|
printf("%d\n", finish);
|
||
|
|
||
|
if (start == finish) return NULL;
|
||
|
return finish;
|
||
|
}
|