fix: quote infinit loop
This commit is contained in:
parent
8366b63821
commit
22b7a4feea
17
spacer.c
17
spacer.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/15 13:35:50 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/15 20:00:42 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 13:17:24 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -25,8 +25,8 @@ static char *ft_spacer_after(const char *str)
|
||||
i = 1;
|
||||
while (out[i] != '\0')
|
||||
{
|
||||
if (ft_is_in_quote(out, i))
|
||||
continue ;
|
||||
while (ft_is_in_quote(out, i))
|
||||
i++;
|
||||
if (ft_is_in("><|", out[i - 1]))
|
||||
{
|
||||
while (str[i] == out[i - 1])
|
||||
@ -54,8 +54,8 @@ static char *ft_spacer_before(const char *str)
|
||||
i = 0;
|
||||
while (out[i + 1] != '\0')
|
||||
{
|
||||
if (ft_is_in_quote(out, i))
|
||||
continue ;
|
||||
while (ft_is_in_quote(out, i))
|
||||
i++;
|
||||
if (ft_is_in("><|", out[i + 1]))
|
||||
{
|
||||
while (out[i] == ' ')
|
||||
@ -81,14 +81,11 @@ static void ft_space_simplifier(char *str)
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
if (ft_is_in_quote(str, i))
|
||||
i++;
|
||||
y = 0;
|
||||
while (str[y + i] == ' ')
|
||||
y++;
|
||||
if (ft_is_in_quote(str, i + y))
|
||||
{
|
||||
i = i + y;
|
||||
continue ;
|
||||
}
|
||||
if (y > 1)
|
||||
{
|
||||
ft_strshift(str + i, -y + 1);
|
||||
|
@ -47,8 +47,8 @@ static int ft_special_char_dub(const char *str)
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
if (ft_is_in_quote(str, i))
|
||||
continue ;
|
||||
while (ft_is_in_quote(str, i))
|
||||
i++;
|
||||
if (ft_is_in("|<>", str[i]))
|
||||
{
|
||||
y = 0;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/15 14:12:00 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/15 17:59:50 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 13:20:50 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -37,7 +37,7 @@ char *ft_quote_remover(char *str)
|
||||
if (start != -1)
|
||||
{
|
||||
ft_strshift(str, -1);
|
||||
str[stop] = '\0';
|
||||
ft_strshift(str + stop - 1, -1);
|
||||
}
|
||||
return (str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user