Piotr Caban : msvcrt: Copy memchr implementation from ntdll.

Alexandre Julliard julliard at winehq.org
Wed Jul 22 16:34:28 CDT 2020


Module: wine
Branch: master
Commit: 9d4eeaeb7773d00d51ff60de29e4be8f43209d68
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9d4eeaeb7773d00d51ff60de29e4be8f43209d68

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jul 22 11:10:19 2020 +0200

msvcrt: Copy memchr implementation from ntdll.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/string.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index a654bb1dde..3a71dc97b0 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -2267,7 +2267,10 @@ char* __cdecl MSVCRT_strrchr(const char *str, int c)
  */
 void* __cdecl MSVCRT_memchr(const void *ptr, int c, MSVCRT_size_t n)
 {
-    return memchr(ptr, c, n);
+    const unsigned char *p = ptr;
+
+    for (p = ptr; n; n--, p++) if (*p == c) return (void *)(ULONG_PTR)p;
+    return NULL;
 }
 
 /*********************************************************************




More information about the wine-cvs mailing list