fix: count the nb of ','
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 17:28:58 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 19:02:08 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/06/16 16:31:06 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -65,15 +65,14 @@ int set_color(long long *color, const char *key, const char *value)
|
||||
ft_eprintf("map: %s redefinition", key);
|
||||
return (1);
|
||||
}
|
||||
tab = ft_split(value, ',');
|
||||
if (tab == NULL)
|
||||
return (1);
|
||||
if (ft_tablen((const void **) tab) != 3)
|
||||
if (ft_count(value, ',') != 2)
|
||||
{
|
||||
ft_freer_tab_ultimate(1, tab);
|
||||
ft_eprintf("map: invalid format %s %s", key, value);
|
||||
return (1);
|
||||
}
|
||||
tab = ft_split(value, ',');
|
||||
if (tab == NULL)
|
||||
return (1);
|
||||
*color = get_color((const char **) tab);
|
||||
ft_freer_tab_ultimate(1, tab);
|
||||
return (*color == -1);
|
||||
|
Reference in New Issue
Block a user