diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-10 18:13:47 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-10 18:13:47 +0200 |
commit | f165808b1cb551cd86655268b8dfa4fb7dcd5eb7 (patch) | |
tree | 3014819ceded1fe93093184d4f2211d4eae065a0 /libft/src/ft_strsubst.c | |
parent | Quick update (diff) | |
download | 42-minishell-f165808b1cb551cd86655268b8dfa4fb7dcd5eb7.tar.gz 42-minishell-f165808b1cb551cd86655268b8dfa4fb7dcd5eb7.tar.bz2 42-minishell-f165808b1cb551cd86655268b8dfa4fb7dcd5eb7.tar.xz 42-minishell-f165808b1cb551cd86655268b8dfa4fb7dcd5eb7.tar.zst 42-minishell-f165808b1cb551cd86655268b8dfa4fb7dcd5eb7.zip |
FIX
Diffstat (limited to '')
-rw-r--r-- | libft/src/ft_strsubst.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libft/src/ft_strsubst.c b/libft/src/ft_strsubst.c index 57e0ac8..3c5c643 100644 --- a/libft/src/ft_strsubst.c +++ b/libft/src/ft_strsubst.c @@ -20,10 +20,10 @@ char char *nstr; char *ptr; - if (!(ptr = ft_strnstr(str, pattern, ft_strlen(str)))) + if ((ptr = ft_strnstr(str, pattern, ft_strlen(str))) == NULL) return (NULL); nlen = ft_strlen(str) - ft_strlen(pattern) + ft_strlen(subst); - if (!(nstr = (char*)malloc((nlen + 1) * sizeof(char)))) + if ((nstr = (char*)malloc((nlen + 1) * sizeof(char))) == NULL) return (NULL); ft_memcpy(nstr, str, ptr - str); ft_memcpy(nstr + (ptr - str), subst, ft_strlen(subst)); |