1 | //===-- Implementation of strsep ------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "src/string/strsep.h" |
10 | |
11 | #include "src/string/string_utils.h" |
12 | |
13 | namespace LIBC_NAMESPACE { |
14 | |
15 | LLVM_LIBC_FUNCTION(char *, strsep, |
16 | (char **__restrict stringp, const char *__restrict delim)) { |
17 | if (!*stringp) |
18 | return nullptr; |
19 | return internal::string_token<false>(src: *stringp, delimiter_string: delim, saveptr: stringp); |
20 | } |
21 | |
22 | } // namespace LIBC_NAMESPACE |
23 | |