blob: 083484c0818766f218441345c675afa774aeb6d9 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_token.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 14:38:57 by dkaiser #+# #+# */
/* Updated: 2024/07/08 16:44:38 by dkaiser ### ########.fr */
/* */
/* ************************************************************************** */
#include "token.h"
void free_token(t_token *token)
{
if (token->previous != NULL)
token->previous->next = NULL;
if (token->next != NULL)
token->next->previous = NULL;
free(token);
}
void free_token_and_connect(t_token *token)
{
if (token->type == STRING_TOKEN)
free(token->content.string);
if (token->previous != NULL)
token->previous->next = token->next;
if (token->next != NULL)
token->next->previous = token->previous;
free(token);
}
|