diff options
Diffstat (limited to 'libft/src/ft_strsubst.c')
-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)); |