Skip to content

Commit 530268c

Browse files
author
Sriya Pratipati
committed
Cleaned up code.
1 parent 0fdb865 commit 530268c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libc/src/wchar/wcscat.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ namespace LIBC_NAMESPACE_DECL {
1919
LLVM_LIBC_FUNCTION(wchar_t *, wcscat,
2020
(wchar_t *__restrict s1, const wchar_t *__restrict s2)) {
2121
size_t size_1 = internal::string_length(s1);
22-
size_t size_2 = internal::string_length(s2);
23-
for (size_t i = 0; i <= size_2; i++) {
22+
size_t i = 0;
23+
for (; s2[i] != L'\0'; i++) {
2424
s1[size_1 + i] = s2[i];
2525
}
26+
s1[size_1 + i] = L'\0';
2627
return s1;
2728
}
2829

0 commit comments

Comments
 (0)