From 9623706effd3f2e3dd1315daa13bc8d0eea168c3 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 1 Jul 2022 03:00:53 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"=E8=A7=A3=E5=86=B3=E5=B0=86RT=5FNULL?= =?UTF-8?q?=E5=BD=93=E5=81=9A=E6=95=B0=E5=AD=970=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6a05ddf63d1202456a37e970e5a9ab58370ed093. --- components/finsh/msh_file.c | 2 +- components/libc/compilers/common/ctime.c | 4 ++-- components/libc/posix/pthreads/pthread.c | 2 +- include/rtdef.h | 6 +----- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c index 7b1a9f8f01..9deab4f0bc 100644 --- a/components/finsh/msh_file.c +++ b/components/finsh/msh_file.c @@ -608,7 +608,7 @@ MSH_CMD_EXPORT_ALIAS(cmd_echo, echo, echo string to file); static int cmd_tail(int argc, char **argv) { int fd; - char c = '\0'; + char c = RT_NULL; char *file_name = RT_NULL; rt_uint32_t total_lines = 0; rt_uint32_t target_line = 0; diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index 8d22dab0c0..6cef1e222d 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -180,7 +180,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r) return RT_NULL; } - rt_memset(r, 0, sizeof(struct tm)); + rt_memset(r, RT_NULL, sizeof(struct tm)); r->tm_sec = work % 60; work /= 60; @@ -258,7 +258,7 @@ char* asctime_r(const struct tm *t, char *buf) return RT_NULL; } - rt_memset(buf, 0, 26); + rt_memset(buf, RT_NULL, 26); /* Checking input validity */ if ((int)rt_strlen(days) <= (t->tm_wday << 2) || (int)rt_strlen(months) <= (t->tm_mon << 2)) diff --git a/components/libc/posix/pthreads/pthread.c b/components/libc/posix/pthreads/pthread.c index 355cbf0f8f..a7dcc9ee7c 100644 --- a/components/libc/posix/pthreads/pthread.c +++ b/components/libc/posix/pthreads/pthread.c @@ -136,7 +136,7 @@ void _pthread_data_destroy(_pthread_data_t *ptd) ptd->magic = 0x0; /* clear the "ptd->tid->user_data" */ - ptd->tid->user_data = 0; + ptd->tid->user_data = RT_NULL; /* free ptd */ rt_free(ptd); diff --git a/include/rtdef.h b/include/rtdef.h index d8aac08ca4..dd5dffc6c5 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -123,11 +123,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #define RT_FALSE 0 /**< boolean fails */ /* null pointer definition */ -#ifdef RT_USING_LIBC -#define RT_NULL NULL /**< null pointer */ -#else -#define RT_NULL (0) /**< null pointer */ -#endif /* RT_USING_LIBC */ +#define RT_NULL 0 /**@}*/ -- GitLab