From 62d2403ebeb456682a88af79d3c93f6072153b6b Mon Sep 17 00:00:00 2001 From: "Man, Jianting (Meco)" <920369182@qq.com> Date: Thu, 28 Apr 2022 20:59:53 -0400 Subject: [kernel] beautify code (#5890) --- src/thread.c | 24 +++++++++++------------- src/timer.c | 8 ++++---- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/thread.c b/src/thread.c index 7bd4ea6e33..f0f1422a02 100755 --- a/src/thread.c +++ b/src/thread.c @@ -85,8 +85,7 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread)) { rt_thread_inited_hook = hook; } - -#endif /* RT_USING_HOOK */ +#endif /* defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) */ static void _thread_exit(void) { @@ -195,7 +194,7 @@ static rt_err_t _thread_init(struct rt_thread *thread, #ifdef RT_USING_EVENT thread->event_set = 0; thread->event_info = 0; -#endif +#endif /* RT_USING_EVENT */ #if RT_THREAD_PRIORITY_MAX > 32 thread->number = 0; @@ -251,12 +250,11 @@ static rt_err_t _thread_init(struct rt_thread *thread, #ifdef RT_USING_CPU_USAGE thread->duration_tick = 0; -#endif - +#endif /* RT_USING_CPU_USAGE */ #ifdef RT_USING_MODULE thread->module_id = 0; -#endif +#endif /* RT_USING_MODULE */ RT_OBJECT_HOOK_CALL(rt_thread_inited_hook, (thread)); @@ -473,13 +471,13 @@ rt_thread_t rt_thread_create(const char *name, } _thread_init(thread, - name, - entry, - parameter, - stack_start, - stack_size, - priority, - tick); + name, + entry, + parameter, + stack_start, + stack_size, + priority, + tick); return thread; } diff --git a/src/timer.c b/src/timer.c index 0600f85694..0034a53c71 100644 --- a/src/timer.c +++ b/src/timer.c @@ -118,10 +118,10 @@ void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer)) * @param flag the flag of timer */ static void _timer_init(rt_timer_t timer, - void (*timeout)(void *parameter), - void *parameter, - rt_tick_t time, - rt_uint8_t flag) + void (*timeout)(void *parameter), + void *parameter, + rt_tick_t time, + rt_uint8_t flag) { int i; -- cgit v1.3.1