| Antonio Nino Diaz | 4661abc | 2018-08-16 14:53:05 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. | ||||
| 3 | * | ||||
| 4 | * SPDX-License-Identifier: BSD-3-Clause | ||||
| 5 | */ | ||||
| 6 | |||||
| 7 | #include <stddef.h> | ||||
| 8 | |||||
| 9 | void *memchr(const void *src, int c, size_t len) | ||||
| 10 | { | ||||
| 11 | const char *s = src; | ||||
| 12 | |||||
| 13 | while (len--) { | ||||
| 14 | if (*s == c) | ||||
| 15 | return (void *) s; | ||||
| 16 | s++; | ||||
| 17 | } | ||||
| 18 | |||||
| 19 | return NULL; | ||||
| 20 | } | ||||