Skip to content
Snippets Groups Projects
Commit f41c3910 authored by kim-dong-hwi's avatar kim-dong-hwi
Browse files

only make malloc

parent 0f9a9d65
Branches
No related tags found
No related merge requests found
#include "alloc.h"
#include <stdio.h>
void *make_malloc(size_t size){
if(!start){
if((start=sbrk(0))){ // break
end=start;
find=-1;
}
else
printf("break address call error");
}
if((find == -1) || (find->next==NULL)){
k_malloc = end;
if(sbrk(size)==-1)
return 0;
k_malloc->next=NULL;
k_malloc->free=0;
k_malloc->size=size;
k_malloc->prev=find;
end += size;
if(find!=-1)
find->next=k_malloc;
find=k_malloc;
}
return find->offset;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment