diff options
Diffstat (limited to '')
-rw-r--r-- | src/u_vars_next.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/u_vars_next.c b/src/u_vars_next.c index 2f23667..0eb8f8b 100644 --- a/src/u_vars_next.c +++ b/src/u_vars_next.c @@ -21,16 +21,15 @@ #include "u_parse.h" #include "u_utils.h" -static int64_t - u_get_env_var_line(const char varname[], t_msh *msh) +static int64_t u_get_env_var_line(const char varname[], t_msh *msh) { char **env_dup; int64_t i; env_dup = u_get_env_var_names(msh); i = 0; - while (env_dup[i] != NULL && - ft_strncmp(varname, env_dup[i], ft_strlen(env_dup[i]) + 1) != 0) + while (env_dup[i] != NULL + && ft_strncmp(varname, env_dup[i], ft_strlen(env_dup[i]) + 1) != 0) { i++; } @@ -42,14 +41,13 @@ static int64_t return (i); } -static t_bool - u_get_custom_var_existance(const char varname[], t_msh *msh) +static t_bool u_get_custom_var_existance(const char varname[], t_msh *msh) { t_lvars *ptr; ptr = msh->vars; - while (ptr && - ft_strncmp(varname, ptr->name, ft_strlen(varname) + 1) != 0) + while (ptr != NULL + && ft_strncmp(varname, ptr->name, ft_strlen(varname) + 1) != 0) { ptr = ptr->next; } @@ -63,11 +61,6 @@ static t_bool } } -/* static void */ -/* u_newval_subst(char newval_subst[], const char newval[]) */ -/* { */ -/* } */ - /* ** void ** u_subst_var_value(const char varname[], const char newval[], t_msh *msh); @@ -79,8 +72,11 @@ static t_bool ** varname[] is added to msh->vars. */ -void - u_subst_var_value(const char varname[], const char newval[], t_msh *msh) +/* +** TODO: Handle malloc fail +*/ + +void u_subst_var_value(const char varname[], const char newval[], t_msh *msh) { char new_line_fmt[ARG_MAX]; int64_t env_line; @@ -92,7 +88,6 @@ void if ((msh->envp[env_line] = (char*)malloc((ft_strlen(new_line_fmt) + 1) * sizeof(char))) == NULL) { - /* TODO: Handle this fail */ } (void)ft_strlcpy(msh->envp[env_line], new_line_fmt, ft_strlen(new_line_fmt) + 1); |