Make ft_parse inputs const, move token_free
authorLukas Jiriste <ljiriste@student.42prague.com>
Fri, 21 Jun 2024 09:49:45 +0000 (11:49 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 21 Jun 2024 09:49:45 +0000 (11:49 +0200)
commitb089bf460fee6e1d871cd147f10c205e4cae2138
tree06b6d2efbfd886b6e6513c63256f0cf7090defee
parentdb5fd5b345729c0c1bd71f6678375c090c99ee5c
Make ft_parse inputs const, move token_free

After playing a little with the functions I thought it stupid to have
all tokens have their own memory for types that repeat so much.
The token_free function I implemented frees both members of token
which leads to multi-frees when reusing a string for type.

This is why I think it will be better to hide token_free again
and the user can decide what to allocate and what to free.

For this to be possible I have guarantee the tokens vector is not
changed inside the ft_parse function, so I've rewriten it a little
to use const.
ft_parse/ft_parse.c
ft_parse/ft_parse_inner.h
inc/ft_parse.h