-
Notifications
You must be signed in to change notification settings - Fork 0
/
coord_list.c
53 lines (46 loc) · 1.43 KB
/
coord_list.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* coord_list.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rvan-der <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 16:20:20 by rvan-der #+# #+# */
/* Updated: 2017/02/21 16:27:41 by rvan-der ### ########.fr */
/* */
/* ************************************************************************** */
#include "filler.h"
t_coord *new_crdlist(int x, int y)
{
t_coord *ret;
ret = (t_coord*)malloc(sizeof(t_coord*));
ret->x = x;
ret->y = y;
ret->next = NULL;
return (ret);
}
void crdlist_pushback(t_coord **list, t_coord *elem)
{
t_coord *tmp;
tmp = *list;
if (tmp == NULL)
*list = elem;
else
{
while (tmp->next != NULL)
tmp = tmp->next;
tmp->next = elem;
}
}
int is_inlist(int x, int y, t_coord *list)
{
t_coord *tmp;
tmp = list;
while (tmp != NULL)
{
if (x == tmp->x && y == tmp->y)
return (1);
tmp = tmp->next;
}
return (0);
}