summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2021-09-22 10:24:12 +0000
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-10-03 05:28:51 +0000
commit05b283f552bb6a47894c120e45235da417e3cb74 (patch)
tree1739e37d7740f842566ded0b1136b37947fec5f1 /Userland
parentfa1208edfd3eff6fac3571a052b6169ef0c27ebf (diff)
downloadserenity-05b283f552bb6a47894c120e45235da417e3cb74.zip
LibC: Implement wmemmove
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibC/wchar.cpp15
-rw-r--r--Userland/Libraries/LibC/wchar.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/wchar.cpp b/Userland/Libraries/LibC/wchar.cpp
index 13208004c2..4bdc43545a 100644
--- a/Userland/Libraries/LibC/wchar.cpp
+++ b/Userland/Libraries/LibC/wchar.cpp
@@ -402,4 +402,19 @@ wchar_t* wmemset(wchar_t* wcs, wchar_t wc, size_t n)
return wcs;
}
+
+wchar_t* wmemmove(wchar_t* dest, const wchar_t* src, size_t n)
+{
+ if (dest > src) {
+ for (size_t i = 1; i <= n; i++) {
+ dest[n - i] = src[n - i];
+ }
+ } else if (dest < src) {
+ for (size_t i = 0; i < n; i++) {
+ dest[i] = src[i];
+ }
+ }
+
+ return dest;
+}
}
diff --git a/Userland/Libraries/LibC/wchar.h b/Userland/Libraries/LibC/wchar.h
index 7f731ad38b..8eea8e919e 100644
--- a/Userland/Libraries/LibC/wchar.h
+++ b/Userland/Libraries/LibC/wchar.h
@@ -46,5 +46,6 @@ wchar_t* wcsstr(const wchar_t*, const wchar_t*);
wchar_t* wmemchr(const wchar_t*, wchar_t, size_t);
wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t);
wchar_t* wmemset(wchar_t*, wchar_t, size_t);
+wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t);
__END_DECLS