Skip to content

Commit 077d275

Browse files
[libc] clean up string_utils memory functions
The string_utils.h file previously included both memcpy and bzero. There were no uses of bzero, and only one use of memcpy which was replaced with __builtin_memcpy.
1 parent af54790 commit 077d275

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

libc/src/string/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ add_header_library(
1515
HDRS
1616
string_utils.h
1717
DEPENDS
18-
.memory_utils.inline_bzero
19-
.memory_utils.inline_memcpy
2018
libc.hdr.types.size_t
21-
libc.include.stdlib
2219
libc.src.__support.CPP.bitset
2320
libc.src.__support.CPP.type_traits
2421
libc.src.__support.common

libc/src/string/string_utils.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "src/__support/CPP/type_traits.h" // cpp::is_same_v
2020
#include "src/__support/macros/config.h"
2121
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
22-
#include "src/string/memory_utils/inline_bzero.h"
23-
#include "src/string/memory_utils/inline_memcpy.h"
2422

2523
namespace LIBC_NAMESPACE_DECL {
2624
namespace internal {
@@ -220,7 +218,7 @@ LIBC_INLINE size_t strlcpy(char *__restrict dst, const char *__restrict src,
220218
if (!size)
221219
return len;
222220
size_t n = len < size - 1 ? len : size - 1;
223-
inline_memcpy(dst, src, n);
221+
__builtin_memcpy(dst, src, n);
224222
dst[n] = '\0';
225223
return len;
226224
}

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4190,7 +4190,6 @@ libc_support_library(
41904190
":__support_cpp_bitset",
41914191
":__support_macros_optimization",
41924192
":llvm_libc_types_size_t",
4193-
":string_memory_utils",
41944193
":types_size_t",
41954194
],
41964195
)

0 commit comments

Comments
 (0)