-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_ldcdpush_front.c
executable file
·33 lines (30 loc) · 1.24 KB
/
ft_ldcdpush_front.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ldcdpush_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tseguier <tseguier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/12/03 04:26:38 by tseguier #+# #+# */
/* Updated: 2014/03/27 18:38:46 by jcoignet ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ldcd_cell.h"
#include "libft.h"
int ft_ldcdpush_front(t_ldcd ldcd, void *elem, size_t elem_size)
{
t_ldcd_cell temp;
if (!ldcd)
return (-1);
temp = ft_ldcd_cellnew(elem, elem_size);
if (!temp)
return (-1);
temp->next = ldcd->head;
ldcd->head = temp;
if (!temp->next)
ldcd->tail = temp;
else
temp->next->prev = temp;
++(ldcd->size);
return (1);
}