lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2002 Manuel Novoa III |
| 3 | * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> |
| 4 | * |
| 5 | * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 6 | */ |
| 7 | |
| 8 | /* No wide analog. */ |
| 9 | |
| 10 | #include "_string.h" |
| 11 | |
| 12 | void *memccpy(void * __restrict s1, const void * __restrict s2, int c, size_t n) |
| 13 | { |
| 14 | register char *r1 = s1; |
| 15 | register const char *r2 = s2; |
| 16 | |
| 17 | while (n-- && (((unsigned char)(*r1++ = *r2++)) != ((unsigned char) c))); |
| 18 | |
| 19 | return (n == (size_t) -1) ? NULL : r1; |
| 20 | } |
| 21 | libc_hidden_def(memccpy) |