Commit ea851944 authored by Lindsay Knupp's avatar Lindsay Knupp
Browse files

End of lab session

parent c14f22f9
......@@ -11,7 +11,7 @@ BIN = ./bin
vpath %.h ./include
vpath %.c ./src
EXECS = dlisttest alloc-dlist_test
EXECS = dlisttest alloc-dlist_test memory-test
all: $(EXECS)
......@@ -24,12 +24,20 @@ $(OBJ)/dnode.o: dnode.h dnode.c
$(OBJ)/dlist.o: dlist.h dlist.c dnode.h
$(CC) $(CFLAGS) -c $(SRC)/dlist.c -o $(OBJ)/dlist.o
$(OBJ)/allocator.o: allocator.h allocator.c dlist.h dnode.h
$(CC) $(CFLAGS) -c $(SRC)/allocator.c -o $(OBJ)/allocator.o
dlisttest: $(SRC)/dlisttest.c $(OBJ)/dnode.o $(OBJ)/dlist.o
$(CC) $(CFLAGS) $(OBJ)/dnode.o $(OBJ)/dlist.o $(SRC)/dlisttest.c -o $(BIN)/dlisttest
alloc-dlist_test: $(SRC)/alloc-dlist_test.c $(OBJ)/dnode.o $(OBJ)/dlist.o
$(CC) $(CFLAGS) $(OBJ)/dnode.o $(OBJ)/dlist.o $(SRC)/alloc-dlist_test.c -o $(BIN)/alloc-dlist_test
memory-test: $(SRC)/memory-test.c $(OBJ)/dnode.o $(OBJ)/dlist.o $(OBJ)/allocator.o
$(CC) $(CFLAGS) $(OBJ)/dnode.o $(OBJ)/dlist.o $(OBJ)/allocator.o $(SRC)/memory-test.c -o $(BIN)/memory-test
.PHONY: clean
clean:
/bin/rm -rf $(BIN)/* $(OBJ)/* core* *~
......
......@@ -7,6 +7,8 @@
#ifndef _ALLOCATOR_H_
#define _ALLOCATOR_H_
struct dlist *free_list;
struct dlist *allocated_list;
/**
* Create and initialize two linked lists, one for
......
......@@ -4,4 +4,16 @@
* Lab 7 - allocator.c
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "allocator.h"
#include "dlist.h"
int allocator_init(size_t size){
free_list = dlist_create();
allocated_list = dlist_create();
return 0;
}
/**
* Lindsay Knupp
* 10/26/21
* Lab 7 - memory-test.c
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "allocator.h"
int main(int argc, char *argv[]){
allocator_init(1024);
printf("Memory-test running\n");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment