summaryrefslogtreecommitdiffstats
path: root/src/s_lvars.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/s_lvars.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/s_lvars.c b/src/s_lvars.c
index 3eb4943..e4b054e 100644
--- a/src/s_lvars.c
+++ b/src/s_lvars.c
@@ -11,8 +11,8 @@
/* ************************************************************************** */
#include <libft.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <errno.h>
#include <unistd.h>
@@ -24,7 +24,7 @@ void
t_lvars *tmp;
tmp = *lvars;
- while (tmp && ft_strncmp(tmp->name, name, ft_strlen(name) + 1))
+ while (tmp != NULL && ft_strncmp(tmp->name, name, ft_strlen(name) + 1) != 0)
{
tmp = tmp->next;
}
@@ -33,10 +33,9 @@ void
return ;
}
ft_memdel((void*)&tmp->val);
- if (!(tmp->val = ft_strdup(newval)))
+ if ((tmp->val = ft_strdup(newval)) == NULL)
{
ft_dprintf(STDERR_FILENO, "%s\n", strerror(errno));
- exit(FT_RET_ALLOC);
}
}
@@ -71,7 +70,7 @@ void
void
lvars_add_front(t_lvars **alvars, t_lvars *new)
{
- if (!alvars || !new)
+ if (alvars == NULL || new == NULL)
{
return ;
}
@@ -88,7 +87,7 @@ void
if (lvars == NULL)
return ;
tmp = *lvars;
- while (tmp)
+ while (tmp != NULL)
{
renext = tmp->next;
ft_memdel((void*)&tmp->name);
@@ -104,15 +103,15 @@ t_lvars
{
t_lvars *link;
- if (!(link = (t_lvars*)malloc(sizeof(t_lvars))))
+ if ((link = (t_lvars*)malloc(sizeof(t_lvars))) == NULL)
{
return (NULL);
}
- if (!(link->name = ft_strdup(name)))
+ if ((link->name = ft_strdup(name)) == NULL)
{
return (NULL);
}
- if (!(link->val = ft_strdup(val)))
+ if ((link->val = ft_strdup(val)) == NULL)
{
return (NULL);
}