summaryrefslogtreecommitdiffstats
path: root/libc/string/memccpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/memccpy.c')
-rw-r--r--libc/string/memccpy.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/libc/string/memccpy.c b/libc/string/memccpy.c
index 2689e80..789fde6 100644
--- a/libc/string/memccpy.c
+++ b/libc/string/memccpy.c
@@ -38,18 +38,9 @@ void *memccpy(void *dst, const void *src, int c, size_t n)
for (;;) {
if (ch == c || p >= p_end) break;
*q++ = ch = *p++;
-
- if (ch == c || p >= p_end) break;
- *q++ = ch = *p++;
-
- if (ch == c || p >= p_end) break;
- *q++ = ch = *p++;
-
- if (ch == c || p >= p_end) break;
- *q++ = ch = *p++;
}
- if (p >= p_end)
+ if (p >= p_end && ch != c)
return NULL;
return q;