From e6fd3ffcd9b5e8d4348db66bd42d9e0ec890533b Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 29 Dec 2021 13:59:46 -0500 Subject: [PATCH] =?UTF-8?q?[libc]=E4=BF=AE=E7=90=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/syscalls.c | 10 ++-------- components/libc/compilers/common/compiler_private.h | 2 -- components/libc/compilers/common/time.c | 4 ++-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index 2dd90cb27c..f4ced9d3c0 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -276,10 +276,7 @@ char *_sys_command_string(char *cmd, int len) void _ttywrch(int ch) { #ifdef RT_USING_CONSOLE - char c; - - c = (char)ch; - rt_kprintf(&c); + rt_kprintf("%c", (char)ch); #endif /* RT_USING_CONSOLE */ } @@ -337,10 +334,7 @@ int remove(const char *filename) int fputc(int c, FILE *f) { #ifdef RT_USING_CONSOLE - char ch[2] = {0}; - - ch[0] = c; - rt_kprintf(&ch[0]); + rt_kprintf("%c", (char)c); return 1; #else return 0; /* error */ diff --git a/components/libc/compilers/common/compiler_private.h b/components/libc/compilers/common/compiler_private.h index 2fd9c51f65..96a49efc7a 100644 --- a/components/libc/compilers/common/compiler_private.h +++ b/components/libc/compilers/common/compiler_private.h @@ -10,8 +10,6 @@ #ifndef __COMPILER_PRIVATE_H__ #define __COMPILER_PRIVATE_H__ -#include - #define _WARNING_WITHOUT_FS "Please enable RT_USING_POSIX_FS" #define _WARNING_WITHOUT_STDIO "Please enable RT_USING_POSIX_FS and RT_USING_POSIX_STDIO" diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 8890a3e830..256268a3fc 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -56,8 +56,8 @@ static const short __spm[13] = (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31), }; -ALIGN(4) static const char days[] = "Sun Mon Tue Wed Thu Fri Sat "; -ALIGN(4) static const char months[] = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec "; +ALIGN(4) static const char *days = "Sun Mon Tue Wed Thu Fri Sat "; +ALIGN(4) static const char *months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec "; static int __isleap(int year) {