File tree 7 files changed +8
-20
lines changed
7 files changed +8
-20
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ choice LIBC_IMPLEMENTATION
15
15
16
16
config ARMCLANG_STD_LIBC
17
17
bool "ARM Compiler C library"
18
+ select COMMON_LIBC_STRNLEN
18
19
select COMMON_LIBC_TIME if POSIX_CLOCK
19
20
help
20
21
Use the full Arm Compiler runtime libraries.
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ config MINIMAL_LIBC
65
65
depends on !REQUIRES_FULL_LIBC
66
66
depends on MINIMAL_LIBC_SUPPORTED
67
67
imply COMPILER_FREESTANDING
68
+ select COMMON_LIBC_STRNLEN
68
69
help
69
70
Build with minimal C library.
70
71
Original file line number Diff line number Diff line change 2
2
3
3
zephyr_library()
4
4
zephyr_library_sources(src/errno.c)
5
- zephyr_library_sources(src/string .c)
6
5
zephyr_library_sources(src/libc-hooks.c)
7
6
zephyr_library_sources_ifndef(CONFIG_MULTITHREADING src/threading_weak.c)
8
7
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ zephyr_library()
4
4
zephyr_library_property(ALLOW_EMPTY TRUE )
5
5
zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_TIME source /time/time.c)
6
6
zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_MALLOC source /stdlib/malloc.c)
7
+ zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_STRNLEN source /string /strnlen.c)
Original file line number Diff line number Diff line change @@ -37,3 +37,8 @@ config COMMON_LIBC_REALLOCARRAY
37
37
help
38
38
Enable the common C library trivial implementation of
39
39
reallocarray, which forwards to realloc.
40
+
41
+ config COMMON_LIBC_STRNLEN
42
+ bool
43
+ help
44
+ common implementation of strnlen().
File renamed without changes.
Original file line number Diff line number Diff line change @@ -116,25 +116,6 @@ size_t strlen(const char *s)
116
116
return n ;
117
117
}
118
118
119
- /**
120
- *
121
- * @brief Get fixed-size string length
122
- *
123
- * @return number of bytes in fixed-size string <s>
124
- */
125
-
126
- size_t strnlen (const char * s , size_t maxlen )
127
- {
128
- size_t n = 0 ;
129
-
130
- while (* s != '\0' && n < maxlen ) {
131
- s ++ ;
132
- n ++ ;
133
- }
134
-
135
- return n ;
136
- }
137
-
138
119
/**
139
120
*
140
121
* @brief Compare two strings
You can’t perform that action at this time.
0 commit comments