Browse Source

norminage

master
narnaud 3 years ago
parent
commit
1226dcfbba
  1. 13
      lexer_2.c

13
lexer_2.c

@ -6,7 +6,7 @@
/* By: mea <mea@student.42.fr> +#+ +:+ +#+ */ /* By: mea <mea@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/16 07:53:17 by narnaud #+# #+# */ /* Created: 2022/05/16 07:53:17 by narnaud #+# #+# */
/* Updated: 2022/05/18 14:44:03 by narnaud@stude ### ########.fr */ /* Updated: 2022/05/24 08:06:11 by narnaud ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -75,18 +75,15 @@ char *get_var_value(t_datas *datas, char *line, int name_len)
if (!ft_strncmp(name, env[0], name_len + 1)) if (!ft_strncmp(name, env[0], name_len + 1))
{ {
if (env[1]) if (env[1])
value = env[1]; value = ft_strdup(env[1]);
else else
value = ft_strdup(""); value = ft_strdup("");
free(env[0]);
} }
else if (++i) ++i;
ft_free_split(env); ft_free_split(env);
} }
free(name); free(name);
if (value) if (!value)
free(env);
else
value = ft_strdup(""); value = ft_strdup("");
return (value); return (value);
} }

Loading…
Cancel
Save