From 6c5368fde3dd7c3f0fb36151eb3efee815abefc9 Mon Sep 17 00:00:00 2001 From: Yevhen Kozirovskyi Date: Sun, 19 Jan 2025 18:06:11 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20sk1/compressor.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sk1/compressor.c | 16 ---------------- 1 file changed, 16 deletions(-) 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