Skip to content

Commit c07572b

Browse files
committed
Merge branch 'master' of github.com:aflock/malloc-lab
2 parents 836c760 + 0b7c459 commit c07572b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

mm_old.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int mm_init(void)
8484
* Sets up metadata for each free group as follows
8585
* 1 byte = free (0) or allocated (1),
8686
* 4 bytes = size of chunk as int (including metadata),
87-
* 3 byte buffer (allowing data to start at a multiple of 8),
87+
* 3 byte buffer (allowing data to start at a multiple of 8),
8888
* ~~~~DATA~~~~~,
8989
* 8 bytes = 00 00 00 00 00 00 00 00/01 = free or alloc
9090
*
@@ -185,24 +185,24 @@ void mm_free(void *argptr)
185185
int size, csize;
186186
char* ptr = argptr;
187187

188-
ptr = (char*)ptr - 3; //Puts ptr at start of pointer position (no 3byte buffer in free blocks)
188+
ptr = (char*)ptr - 3; //Puts ptr at start of pointer position (no 3byte buffer in free blocks)
189189
size = *((int*)ptr - 1);
190190

191191
/*
192192
* Begin Coalescing
193193
*/
194-
// if(*(ptr - 6) == 0) { //the block BEFORE is a free block
194+
// if(*(ptr - 6) == 0) { //the block BEFORE is a free block
195195
// ptr = (char*)ptr - 6;
196-
// csize = *((int*)ptr - 1); //size of the previous block
196+
// csize = *((int*)ptr - 1); //size of the previous block
197197
// if (csize > 0) {
198-
// ptr = (char*)ptr - 3 - csize; //sets pointer to pointer portion of previous block
198+
// ptr = (char*)ptr - 3 - csize; //sets pointer to pointer portion of previous block
199199
// size = size + csize + 16;
200200
// }
201201
// }
202-
//
203-
// if(*(ptr + size + 8) == 0) //the block AFTER is a free block
202+
//
203+
// if(*(ptr + size + 8) == 0) //the block AFTER is a free block
204204
// {
205-
// csize = *((int*)((char*)ptr + size + 9)); //size of the next block
205+
// csize = *((int*)((char*)ptr + size + 9)); //size of the next block
206206
// if (csize > 0) {
207207
// size = size + csize + 16;
208208
// }
@@ -340,7 +340,7 @@ int mm_check(void)
340340
*/
341341

342342
int mm_insert(void* loc, int size) {
343-
343+
344344
void* location = loc;
345345
int i = 0, j = 0;
346346
int flag = 1;

0 commit comments

Comments
 (0)