aboutsummaryrefslogtreecommitdiff
path: root/c09/ex02
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-16 12:58:13 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-16 12:58:13 +0200
commit14914f50c3de6c5444e13cf67db064b03c1c90ef (patch)
tree3ecf5a41b4541980ba0287a431681cd5ae25ad84 /c09/ex02
parent217bcb0d4e3ba60604921cb40d5a11a64f93cfc7 (diff)
downloadpiscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.tar.gz
piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.tar.bz2
piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.zip
c09 passed, c10 start, exam00 and exam01
Diffstat (limited to 'c09/ex02')
-rw-r--r--c09/ex02/ft_split.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/c09/ex02/ft_split.c b/c09/ex02/ft_split.c
index e1c0186..a11477f 100644
--- a/c09/ex02/ft_split.c
+++ b/c09/ex02/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/15 09:21:14 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);
@@ -70,7 +71,5 @@ char **heck(char *str, char *charset, char *tmp, int i)
char **ft_split(char *str, char *charset)
{
- if (!*str)
- return (NULL);
return (heck(str, charset, NULL, 0));
}