Skip to content

Commit 6f386ab

Browse files
remove wide_string_utils, reuse string_length_byte_read (renamed)
1 parent a8173a1 commit 6f386ab

File tree

4 files changed

+6
-40
lines changed

4 files changed

+6
-40
lines changed

libc/src/string/string_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ LIBC_INLINE size_t string_length_wide_read(const char *src) {
7979
return char_ptr - src;
8080
}
8181

82-
LIBC_INLINE size_t string_length_byte_read(const char *src) {
82+
template<typename T>
83+
LIBC_INLINE size_t string_length_trivial(const T *src) {
8384
size_t length;
8485
for (length = 0; *src; ++src, ++length)
8586
;
@@ -96,7 +97,7 @@ LIBC_INLINE size_t string_length(const char *src) {
9697
// string a block at a time.
9798
return string_length_wide_read<unsigned int>(src);
9899
#else
99-
return string_length_byte_read(src);
100+
return string_length_trivial(src);
100101
#endif
101102
}
102103

libc/src/wchar/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
add_header_library(
2-
wide_string_utils
3-
HDRS
4-
wide_string_utils.h
5-
)
6-
71
add_entrypoint_object(
82
wcslen
93
SRCS
104
wcslen.cpp
115
HDRS
126
wcslen.h
137
DEPENDS
14-
.wide_string_utils
158
libc.hdr.types.size_t
169
libc.hdr.types.wchar_t
10+
libc.src.string.string_utils
1711
)
1812

1913
add_entrypoint_object(

libc/src/wchar/wcslen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#include "hdr/types/wchar_t.h"
1313
#include "src/__support/common.h"
1414
#include "src/__support/macros/config.h"
15-
#include "src/wchar/wide_string_utils.h"
15+
#include "src/string/string_utils.h" // string_length_trivial
1616

1717
namespace LIBC_NAMESPACE_DECL {
1818

1919
LLVM_LIBC_FUNCTION(size_t, wcslen, (const wchar_t *src)) {
20-
return internal::wide_string_length(src);
20+
return internal::string_length_trivial(src);
2121
}
2222

2323
} // namespace LIBC_NAMESPACE_DECL

libc/src/wchar/wide_string_utils.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)