diff options
author | Matt Strapp <strap012@umn.edu> | 2020-10-05 09:28:48 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-10-05 09:28:48 -0500 |
commit | 0f506916b218b17fa8162b21962b8d76044f4310 (patch) | |
tree | 3781bf8a3c6cfdebf1358ed0363483aa6d76cf71 /P1 | |
parent | Attempt to fix things and fail (diff) | |
download | csci4061-0f506916b218b17fa8162b21962b8d76044f4310.tar csci4061-0f506916b218b17fa8162b21962b8d76044f4310.tar.gz csci4061-0f506916b218b17fa8162b21962b8d76044f4310.tar.bz2 csci4061-0f506916b218b17fa8162b21962b8d76044f4310.tar.lz csci4061-0f506916b218b17fa8162b21962b8d76044f4310.tar.xz csci4061-0f506916b218b17fa8162b21962b8d76044f4310.tar.zst csci4061-0f506916b218b17fa8162b21962b8d76044f4310.zip |
Fix mapper???????
POG
Diffstat (limited to 'P1')
-rw-r--r-- | P1/src/mapper.c | 34 |
1 files 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 <word, value list> @@ -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 <key, value> 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[]) { |