feat: update structure
This commit is contained in:
25
cs2106/labs/lab4/linkedlist/mymalloc.c
Normal file
25
cs2106/labs/lab4/linkedlist/mymalloc.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "mymalloc.h"
|
||||
|
||||
char _heap[MEMSIZE] = {0};
|
||||
TNode *_memlist = NULL; // To maintain information about length
|
||||
|
||||
// Do not change this. Used by the test harness.
|
||||
// You may however use this function in your code if necessary.
|
||||
long get_index(void *ptr) {
|
||||
if(ptr == NULL)
|
||||
return -1;
|
||||
else
|
||||
return (long) ((char *) ptr - &_heap[0]);
|
||||
}
|
||||
|
||||
// Allocates size bytes of memory and returns a pointer
|
||||
// to the first byte.
|
||||
void *mymalloc(size_t size) {
|
||||
}
|
||||
|
||||
// Frees memory pointer to by ptr.
|
||||
void myfree(void *ptr) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user