Skip to content

[libc] remove strnlen from rtthread.h #6026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/simulator/drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ src = ['board.c', 'uart_console.c']
LIBS = []
LIBPATH = []
CPPPATH = [cwd]
CPPDEFINES = []
CPPDEFINES = ['RT_USING_LIBC']

if rtconfig.CROSS_TOOL == 'msvc':
CPPDEFINES += \
Expand Down
2 changes: 1 addition & 1 deletion components/libc/compilers/armlibc/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Import('rtconfig')
src = Glob('*.c')
group = []

CPPDEFINES = ['RT_USING_ARM_LIBC', 'RT_USING_LIBC']
CPPDEFINES = ['RT_USING_ARM_LIBC', 'RT_USING_LIBC', '__STDC_LIMIT_MACROS']

if rtconfig.PLATFORM in ['armcc', 'armclang']:
group = DefineGroup('Compiler', src, depend = [''], CPPDEFINES = CPPDEFINES)
Expand Down
2 changes: 1 addition & 1 deletion components/libc/compilers/dlib/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Import('rtconfig')
src = Glob('*.c')
group = []

CPPDEFINES = ['RT_USING_DLIBC', 'RT_USING_LIBC']
CPPDEFINES = ['RT_USING_DLIBC', 'RT_USING_LIBC', '_DLIB_ADD_EXTRA_SYMBOLS=0']

if rtconfig.PLATFORM == 'iar':
if GetDepend('DFS_USING_POSIX'):
Expand Down
16 changes: 2 additions & 14 deletions include/rtthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,8 @@ void *rt_memcpy(void *dest, const void *src, rt_ubase_t n);
void *rt_memmove(void *dest, const void *src, rt_size_t n);
rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_size_t count);
#endif /* RT_KSERVICE_USING_STDLIB_MEMORY */

char *rt_strdup(const char *s);
rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen);
#ifndef RT_KSERVICE_USING_STDLIB
char *rt_strstr(const char *str1, const char *str2);
rt_int32_t rt_strcasecmp(const char *a, const char *b);
Expand All @@ -631,19 +632,6 @@ rt_size_t rt_strlen(const char *src);
#define rt_strlen(src) strlen(src)
#endif /*RT_KSERVICE_USING_STDLIB*/

char *rt_strdup(const char *s);

#if !defined(RT_KSERVICE_USING_STDLIB) || defined(__ARMCC_VERSION)
rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen);
#else
#define rt_strnlen(s, maxlen) strnlen(s, maxlen)
#endif /* !defined(RT_KSERVICE_USING_STDLIB) || defined(__ARMCC_VERSION) */

#ifdef __ARMCC_VERSION
/* MDK doesn't have these APIs */
rt_size_t strnlen(const char *s, rt_size_t maxlen);
#endif /* __ARMCC_VERSION */

void rt_show_version(void);

#ifdef RT_DEBUG
Expand Down