summaryrefslogtreecommitdiffstats
path: root/include/c/str/len/strlen.h
blob: 9ed7a0d71f3a7c216a9bf7f22cef5146574107c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2022 Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier:  LGPL-3.0-or-later WITH LGPL-3.0-linking-exception


#ifndef INCLUDE_C_STR_LEN_STRLEN_H_
#define INCLUDE_C_STR_LEN_STRLEN_H_


#include <stddef.h>
#include <string.h>

#include <c/str/len/strnul.h>


#pragma clang assume_nonnull begin
inline size_t c_strlen(const char *s);
inline size_t c_strnlen(const char *s, size_t sz);


inline size_t
c_strlen(const char *s)
{
	return c_strnul(s) - s;
}


inline size_t
c_strnlen(const char *s, size_t sz)
{
	return strnlen(s, sz);
}
#pragma clang assume_nonnull end


#endif  // Header guard