diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-11 21:07:32 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-11 21:23:49 +0100 |
| commit | c128213daa677d548bfc2905496257fe4a4faf79 (patch) | |
| tree | d087ceaeff3124ff539bc05d834d79f8187d5628 /src/str/ft_substr.c | |
| parent | 3c3f1115f6e9a9b914e2dcbd796501ca7ce85342 (diff) | |
| download | libft-c128213daa677d548bfc2905496257fe4a4faf79.tar.gz libft-c128213daa677d548bfc2905496257fe4a4faf79.tar.bz2 libft-c128213daa677d548bfc2905496257fe4a4faf79.zip | |
ft_mem* and ft_strlen optimization
Diffstat (limited to 'src/str/ft_substr.c')
| -rw-r--r-- | src/str/ft_substr.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/str/ft_substr.c b/src/str/ft_substr.c index ad9c706..59fe3f2 100644 --- a/src/str/ft_substr.c +++ b/src/str/ft_substr.c @@ -20,6 +20,7 @@ char *ft_substr(char const *s, unsigned int start, size_t len) return (NULL); if ((sub = (char*)malloc(sizeof(char) * (len + 1))) == NULL) return (NULL); + sub[len] = '\0'; if (start > ft_strlen(s)) return (sub); return (ft_strncpy(sub, s + start, len)); |
