[NFC][Py Reformat] Added more commits to .git-blame-ignore-revs
[llvm-project.git] / libc / src / string / memory_utils / strstr_implementations.h
blobd24aedd58cdbc337af30fb406f9c7062fd9c8fcd
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_STRSTR_IMPLEMENTATIONS_H
10 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_STRSTR_IMPLEMENTATIONS_H
12 #include "src/string/memory_utils/memmem_implementations.h"
13 #include "src/string/string_utils.h"
14 #include <stddef.h>
16 namespace __llvm_libc {
18 template <typename Comp>
19 constexpr static char *strstr_implementation(const char *haystack,
20 const char *needle, Comp &&comp) {
21 void *result = memmem_implementation(
22 static_cast<const void *>(haystack), internal::string_length(haystack),
23 static_cast<const void *>(needle), internal::string_length(needle), comp);
24 return static_cast<char *>(result);
27 } // namespace __llvm_libc
29 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_STRSTR_IMPLEMENTATIONS_H