Introduce `strxfrm` and unit tests. The current implementation is introduced without locale support. The simplified function performs a `memcpy` if the `n` value is large enough to store the source len + '\0', otherwise `dest` is unmodified. Ticket: https://fxbug.dev/124217 Differential Revision: https://reviews.llvm.org/D147478
20 lines
655 B
C++
20 lines
655 B
C++
//===-- Implementation header for strxfrm -----------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIBC_SRC_STRING_STRXFRM_H
|
|
#define LLVM_LIBC_SRC_STRING_STRXFRM_H
|
|
|
|
#include <stddef.h> // For size_t
|
|
namespace __llvm_libc {
|
|
|
|
size_t strxfrm(char *__restrict dest, const char *__restrict src, size_t n);
|
|
|
|
} // namespace __llvm_libc
|
|
|
|
#endif // LLVM_LIBC_SRC_STRING_STRXFRM_H
|