_
This commit is contained in:
11
env/env1.c
vendored
11
env/env1.c
vendored
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/02 14:39:56 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/03/30 13:07:15 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/04/18 12:47:08 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -34,7 +34,11 @@ void add_sort(t_list **head, t_env *var)
|
||||
}
|
||||
}
|
||||
if (current->next == NULL)
|
||||
{
|
||||
current->next = ft_calloc(1, sizeof(t_list));
|
||||
if (!current->next)
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
char *get_value_by_key(char *key, t_list **head)
|
||||
@ -61,9 +65,7 @@ int set_value_by_key(char *key, char *value, t_list **head)
|
||||
if (ft_strcmp(((t_env *)current->content)->key, key) == 0)
|
||||
{
|
||||
free(((t_env *)current->content)->value);
|
||||
free(((t_env *)current->content)->key);
|
||||
((t_env *)current->content)->value = value;
|
||||
((t_env *)current->content)->key = key;
|
||||
return (0);
|
||||
}
|
||||
current = current->next;
|
||||
@ -97,7 +99,10 @@ t_list **init_env(char **env)
|
||||
return (NULL);
|
||||
*head = ft_calloc(1, sizeof(t_list));
|
||||
if (*head == NULL)
|
||||
{
|
||||
free(head);
|
||||
return (NULL);
|
||||
}
|
||||
i = -1;
|
||||
while (env[++i])
|
||||
{
|
||||
|
2
env/env2.c
vendored
2
env/env2.c
vendored
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/09 19:59:03 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/03/09 19:59:10 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/04/18 13:26:31 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
Reference in New Issue
Block a user