Warning: This file is not a C or C++ file. It does not have highlighting.
| 1 | //===-- str{,case}str implementation ----------------------------*- C++ -*-===// |
|---|---|
| 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 | #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H |
| 10 | #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H |
| 11 | |
| 12 | #include "src/__support/macros/attributes.h" // LIBC_INLINE |
| 13 | #include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL |
| 14 | #include "src/string/memory_utils/inline_memmem.h" |
| 15 | #include "src/string/string_utils.h" |
| 16 | #include <stddef.h> |
| 17 | |
| 18 | namespace LIBC_NAMESPACE_DECL { |
| 19 | |
| 20 | template <typename Comp> |
| 21 | LIBC_INLINE constexpr char *inline_strstr(const char *haystack, |
| 22 | const char *needle, Comp &&comp) { |
| 23 | void *result = inline_memmem( |
| 24 | static_cast<const void *>(haystack), internal::string_length(haystack), |
| 25 | static_cast<const void *>(needle), internal::string_length(needle), comp); |
| 26 | return static_cast<char *>(result); |
| 27 | } |
| 28 | |
| 29 | } // namespace LIBC_NAMESPACE_DECL |
| 30 | |
| 31 | #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H |
| 32 |
Warning: This file is not a C or C++ file. It does not have highlighting.
