blob: 699f9c5ce22d6aa90bc8cd3d64eb64a9fdec9c22 [file] [log] [blame]
xiaohu.huang9169c492022-11-18 16:30:06 +08001/*
2 * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7#include "aml_strnlen.h"
8
9#if (1 == CONFIG_ARM64)
10size_t strnlen(const char *s, size_t maxlen)
11#else
12int strnlen(const char *s, int maxlen)
13#endif
14{
15 const char *ss = s;
16
17 while ((maxlen > 0) && *ss) {
18 ss++;
19 maxlen--;
20 }
21 return ss - s;
22}