-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmap_init.c
More file actions
37 lines (34 loc) · 1.22 KB
/
Copy pathmap_init.c
File metadata and controls
37 lines (34 loc) · 1.22 KB
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
32
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* map_init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mihykim <mihykim@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/01 12:30:16 by mihykim #+# #+# */
/* Updated: 2020/06/01 13:01:53 by mihykim ### ########.fr */
/* */
/* ************************************************************************** */
#include "map.h"
t_hash_map *map_init(void)
{
t_hash_map *map;
int i;
map = malloc(sizeof(t_hash_map));
if (map == NULL)
return (NULL);
map->map = malloc(sizeof(t_node *) * BIG_PRIME);
if (map->map == NULL)
{
free(map);
return (NULL);
}
i = 0;
while (i < BIG_PRIME)
{
map->map[i] = NULL;
i++;
}
map->size = 0;
return (map);
}