-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_dlstrotate.c
31 lines (27 loc) · 1.18 KB
/
ft_dlstrotate.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_dlstrotate.c :+: :+: */
/* +:+ */
/* By: jaberkro <[email protected]> +#+ */
/* +#+ */
/* Created: 2022/02/24 12:51:01 by jaberkro #+# #+# */
/* Updated: 2022/04/14 12:28:34 by jaberkro ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_dlstrotate(t_dlist **dlst)
{
t_dlist *copy;
t_dlist *tmp;
tmp = *dlst;
copy = tmp;
while (tmp->next != NULL)
tmp = tmp->next;
tmp->next = *dlst;
tmp->next->previous = tmp;
copy->next->previous = NULL;
*dlst = copy->next;
copy->next = NULL;
}
/* Rotate a doubly linked list. */