Update ft_substr.c
This commit is contained in:
parent
879848cde1
commit
5f330edb54
1 changed files with 0 additions and 4 deletions
|
|
@ -14,16 +14,12 @@
|
|||
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
size_t j;
|
||||
char *str;
|
||||
|
||||
i = start;
|
||||
if (start >= ft_strlen(s))
|
||||
return (ft_strdup(""));
|
||||
if (len + start > (ft_strlen(s)))
|
||||
len = ft_strlen(s) - start;
|
||||
j = 0;
|
||||
str = (char *)malloc(len + 1);
|
||||
if (!str || !s)
|
||||
return (free(str), ft_strdup(""));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue