From 0f506916b218b17fa8162b21962b8d76044f4310 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 5 Oct 2020 09:28:48 -0500 Subject: Fix mapper??????? POG --- P1/src/mapper.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/P1/src/mapper.c b/P1/src/mapper.c index 3350288..e430bb3 100644 --- a/P1/src/mapper.c +++ b/P1/src/mapper.c @@ -23,14 +23,14 @@ valueList *insertNewValueToList(valueList *root, char *count){ // free value list void freeValueList(valueList *root) { - if(root == NULL) return; +if(root == NULL) return; - valueList *tempNode = NULL; - while (root != NULL){ - tempNode = root; - root = root -> next; - free(tempNode); - } +valueList *tempNode = NULL; +while (root != NULL){ +tempNode = root; +root = root -> next; +free(tempNode); +} } // create @@ -69,12 +69,12 @@ void freeInterDS(intermediateDS *root) { if(root == NULL) return; intermediateDS *tempNode = NULL; -while (root != NULL) { - tempNode = root; - root = root -> next; - freeValueList(tempNode -> value); - free(tempNode); - } +while (root != NULL){ +tempNode = root; +root = root -> next; +freeValueList(tempNode -> value); +free(tempNode); +} } // emit the into intermediate DS @@ -106,10 +106,10 @@ void writeIntermediateDS() { while(tempNode != NULL) { // Get string of 1's associated with the word - char ones[100]; - // tempNode2 = tempNode2 -> value; + char ones[100]= ""; + tempNode2 = tempNode -> value; while(tempNode2 != NULL) { - printf("This loop is being run\n"); + //printf("This loop is being run\n"); strcat(ones, "1 "); tempNode2 = tempNode2 -> next; } @@ -121,7 +121,7 @@ void writeIntermediateDS() { fclose(fptr); tempNode = tempNode -> next; } - freeInterDS(root); + //freeInterDS(root); } int main(int argc, char *argv[]) { -- cgit v1.2.3