blob: 66d7ba169a0783f4230b60b578779726f655a8e8 [file] [log] [blame]
Imre Kisf55f2aa2024-05-28 15:55:19 +02001/*
2 * Copyright (c) 2013-2019, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stddef.h>
8#include <string.h>
9
10void *memchr(const void *src, int c, size_t len)
11{
12 const unsigned char *s = src;
13
14 while (len--) {
15 if (*s == (unsigned char)c)
16 return (void *) s;
17 s++;
18 }
19
20 return NULL;
21}