-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfree_utils.c
31 lines (29 loc) · 1.22 KB
/
free_utils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fnacarel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/13 12:06:12 by fnacarel #+# #+# */
/* Updated: 2023/01/14 20:42:09 by fnacarel ### ########.fr */
/* */
/* ************************************************************************** */
#include "./encoder.h"
void free_matr(void **matr, int size)
{
for (int i = 0; i < size; i++)
free(matr[i]);
free(matr);
}
void free_stuff(char *uniq_chars, int *freq, char **dict, char *encoded_str)
{
if (uniq_chars)
free(uniq_chars);
if (freq)
free(freq);
if (dict)
free_matr((void **)dict, ASCII_LEN);
if (encoded_str)
free(encoded_str);
}