aboutsummaryrefslogtreecommitdiff
path: root/c07
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-08-06 18:19:11 +0200
committerCharles <sircharlesaze@gmail.com>2019-08-06 18:19:11 +0200
commitc6d343fccb84e9fc89dfc75b3f35a352e97b14a4 (patch)
tree5cde66a3b489c7882b6d7ba062df5a70dbaf0666 /c07
parent056a88ee9c2c9e26f9712d14c645e367d851f394 (diff)
downloadpiscine-c6d343fccb84e9fc89dfc75b3f35a352e97b14a4.tar.gz
piscine-c6d343fccb84e9fc89dfc75b3f35a352e97b14a4.tar.bz2
piscine-c6d343fccb84e9fc89dfc75b3f35a352e97b14a4.zip
details, print_memory start
- copied c09 correct ft_split to c07 - strdup parenthesis in malloc - strlcat copied from tested libft
Diffstat (limited to 'c07')
-rw-r--r--c07/ex00/ft_strdup.c2
-rw-r--r--c07/ex05/ft_split.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/c07/ex00/ft_strdup.c b/c07/ex00/ft_strdup.c
index 754f317..4cf3b3a 100644
--- a/c07/ex00/ft_strdup.c
+++ b/c07/ex00/ft_strdup.c
@@ -28,7 +28,7 @@ char *ft_strdup(char *src)
int i;
char *dup_ptr;
- dup_ptr = (char*)malloc(sizeof(char) * ft_strlen(src) + 1);
+ dup_ptr = (char*)malloc(sizeof(char) * (ft_strlen(src) + 1));
if (dup_ptr == NULL)
{
errno = ENOMEM;
diff --git a/c07/ex05/ft_split.c b/c07/ex05/ft_split.c
index 3ff2e43..a11477f 100644
--- a/c07/ex05/ft_split.c
+++ b/c07/ex05/ft_split.c
@@ -6,7 +6,7 @@
/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/08 15:58:03 by cacharle #+# #+# */
-/* Updated: 2019/07/13 08:15:31 by cacharle ### ########.fr */
+/* Updated: 2019/07/16 09:18:23 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -62,7 +62,8 @@ char **heck(char *str, char *charset, char *tmp, int i)
while (!in_charset(*str, charset) && *str)
tmp[i++] = *str++;
tmp[i] = '\0';
- strs[j++] = tmp;
+ if (i != 0)
+ strs[j++] = tmp;
}
strs[j] = 0;
return (strs);