You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/06/05 12:29:35 UTC

[incubator-nuttx] 02/02: sched/task: Avoid the cast in atexit when CONFIG_SCHED_ONEXIT is defined

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 09f64dd0ac3d0d789afdebb5500f2b9f88422a7b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Jun 3 18:12:10 2020 +0800

    sched/task: Avoid the cast in atexit when CONFIG_SCHED_ONEXIT is defined
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: Ic3360555fa8bb24d5dae52e7ae5bb5fb5c24de0c
---
 sched/task/task_atexit.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sched/task/task_atexit.c b/sched/task/task_atexit.c
index da29b64..8031c68 100644
--- a/sched/task/task_atexit.c
+++ b/sched/task/task_atexit.c
@@ -53,6 +53,17 @@
 #ifdef CONFIG_SCHED_ATEXIT
 
 /****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_SCHED_ONEXIT
+static void exitfunc(int exitcode, FAR void *arg)
+{
+  (*(atexitfunc_t)arg)();
+}
+#endif
+
+/****************************************************************************
  * Public Functions
  ****************************************************************************/
 
@@ -95,7 +106,7 @@ int atexit(void (*func)(void))
    * it expects).
    */
 
-  return on_exit((onexitfunc_t)func, NULL);
+  return on_exit(exitfunc, func);
 
 #else
   FAR struct tcb_s *tcb = this_task();