diff options
Diffstat (limited to '')
-rw-r--r-- | P1/src/mapper.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/P1/src/mapper.c b/P1/src/mapper.c index e430bb3..f234859 100644 --- a/P1/src/mapper.c +++ b/P1/src/mapper.c @@ -66,15 +66,15 @@ intermediateDS *insertPairToInterDS(intermediateDS *root, char *word, char *coun // free the DS after usage. Call this once you are done with the writing of DS into file void freeInterDS(intermediateDS *root) { -if(root == NULL) return; - -intermediateDS *tempNode = NULL; -while (root != NULL){ -tempNode = root; -root = root -> next; -freeValueList(tempNode -> value); -free(tempNode); -} + if(root == NULL) return; + + intermediateDS *tempNode = NULL; + while (root != NULL){ + tempNode = root; + root = root -> next; + freeValueList(tempNode -> value); + free(tempNode); + } } // emit the <key, value> into intermediate DS @@ -121,7 +121,7 @@ void writeIntermediateDS() { fclose(fptr); tempNode = tempNode -> next; } - //freeInterDS(root); + freeInterDS(root); } int main(int argc, char *argv[]) { |