Skip to content

Commit c42912b

Browse files
authored
Fix string_length function so that it always returns. (#144148)
Previously setting LIBC_COPT_STRING_UNSAFE_WIDE_READ would cause a build error because there is a path in the ifdef that doesn't return anything.
1 parent 1ded2c5 commit c42912b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

libc/src/string/string_utils.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ template <typename T> LIBC_INLINE size_t string_length(const T *src) {
9090
// string a block at a time.
9191
if constexpr (cpp::is_same_v<T, char>)
9292
return string_length_wide_read<unsigned int>(src);
93-
#else
93+
#endif
9494
size_t length;
9595
for (length = 0; *src; ++src, ++length)
9696
;
9797
return length;
98-
#endif
9998
}
10099

101100
template <typename Word>

0 commit comments

Comments
 (0)