brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 5495cc4 Raw
32 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H10#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H11 12#include "src/__support/macros/attributes.h" // LIBC_INLINE13#include "src/__support/macros/config.h"     // LIBC_NAMESPACE_DECL14#include "src/string/memory_utils/inline_memmem.h"15#include "src/string/string_utils.h"16#include <stddef.h>17 18namespace LIBC_NAMESPACE_DECL {19 20template <typename Comp>21LIBC_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_DECL30 31#endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H32