aboutsummaryrefslogtreecommitdiff
path: root/src/str/ft_strjoin.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-14 03:46:08 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-14 03:46:08 +0100
commit9af2885d872de9c60b11159efe0685738031096d (patch)
tree813183555eae5d0a84f11d7be3178d07b3d5f9d9 /src/str/ft_strjoin.c
parentadbcf69ed50ea3896d4bbe863ea5d214ae5a0299 (diff)
downloadlibft-9af2885d872de9c60b11159efe0685738031096d.tar.gz
libft-9af2885d872de9c60b11159efe0685738031096d.tar.bz2
libft-9af2885d872de9c60b11159efe0685738031096d.zip
Added documentation for all functions and refactored ft_strjoin_free -> ft_strjoinf
Diffstat (limited to 'src/str/ft_strjoin.c')
-rw-r--r--src/str/ft_strjoin.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/str/ft_strjoin.c b/src/str/ft_strjoin.c
index 2bc4908..b65eaa2 100644
--- a/src/str/ft_strjoin.c
+++ b/src/str/ft_strjoin.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:35:26 by cacharle #+# #+# */
-/* Updated: 2019/11/20 04:02:20 by cacharle ### ########.fr */
+/* Updated: 2020/02/14 03:40:39 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,7 +18,8 @@ char *ft_strjoin(char const *s1, char const *s2)
if (s1 == NULL || s2 == NULL)
return (NULL);
- if ((joined = ft_strnew(ft_strlen(s1) + ft_strlen(s2))) == NULL)
+ if ((joined = (char*)malloc(sizeof(char)
+ * (ft_strlen(s1) + ft_strlen(s2) + 1))) == NULL)
return (NULL);
return (ft_strcat(ft_strcpy(joined, s1), s2));
}