diff options
-rw-r--r-- | libft/src/ft_substr.c | 7 | ||||
-rw-r--r-- | src/ft_p_lcom_next.c | 3 | ||||
-rw-r--r-- | src/ft_p_line.c | 1 |
3 files changed, 2 insertions, 9 deletions
diff --git a/libft/src/ft_substr.c b/libft/src/ft_substr.c index 6d94368..947a305 100644 --- a/libft/src/ft_substr.c +++ b/libft/src/ft_substr.c @@ -23,11 +23,6 @@ char i = 0; if (!(nstr = (char*)malloc((len + 1) * sizeof(char)))) return (NULL); - while (s[start + i] && i < len) - { - nstr[i] = s[start + i]; - i++; - } - nstr[i] = '\0'; + ft_strlcpy(nstr, s + start, len + 1); return (nstr); } diff --git a/src/ft_p_lcom_next.c b/src/ft_p_lcom_next.c index 272931d..c4666f4 100644 --- a/src/ft_p_lcom_next.c +++ b/src/ft_p_lcom_next.c @@ -39,9 +39,8 @@ char varlen = i + 1; while ((*p_words)[varlen] != '\0' && (*p_words)[varlen] != '$') varlen += 1; - if (!(s_varname = ft_substr(*p_words, (uint32_t)i, varlen))) + if (!(s_varname = ft_substr(*p_words, (uint32_t)i, varlen - i))) return (NULL); - ft_printf("a\n"); varval = ft_subst_var_value(s_varname, msh); *p_words = ft_strsubst(*p_words, s_varname, varval); ft_memdel((void*)&s_varname); diff --git a/src/ft_p_line.c b/src/ft_p_line.c index b827503..b1ba6b2 100644 --- a/src/ft_p_line.c +++ b/src/ft_p_line.c @@ -41,7 +41,6 @@ void { count -= 1; } - ft_printf("%lu\n", count); if (ft_p_lcom(line, count, msh) < 0) { ft_s_destroy(msh); |