diff --git a/sk1/compressor.c b/sk1/compressor.c index b431d21..2ab8526 100644 --- a/sk1/compressor.c +++ b/sk1/compressor.c @@ -136,23 +136,7 @@ struct MinHeapNode* buildHuffmanTree(unsigned char data[], int freq[], int size) } // Print Huffman Codes to a map -void storeCodes(struct MinHeapNode* root, char** codes, char* currentCode, int top) { - if (!root) return; - if (root->left) { - currentCode[top] = '0'; - storeCodes(root->left, codes, currentCode, top + 1); - } - if (root->right) { - currentCode[top] = '1'; - storeCodes(root->right, codes, currentCode, top + 1); - } - if (!(root->left) && !(root->right)) { - currentCode[top] = '\0'; - codes[root->data] = (char*)malloc(strlen(currentCode) + 1); // Use malloc instead of strdup - strcpy(codes[root->data], currentCode); // Copy the string - } -} // Updated compressFile function