This is an automated email from Gerrit.

Marc Schink ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4274

-- gerrit

commit 0421e15c8e46ae51fd44556f284bb852bdeeb8da
Author: Marc Schink <[email protected]>
Date:   Sun Oct 29 11:39:51 2017 +0100

    rtos: Use 'bool' as return type for detect_rtos()
    
    Change-Id: I91ad0431d44ed94f48d20c4690f8642d66f52a9b
    Signed-off-by: Marc Schink <[email protected]>

diff --git a/src/rtos/ChibiOS.c b/src/rtos/ChibiOS.c
index 1bc1af8..ef0bb16 100644
--- a/src/rtos/ChibiOS.c
+++ b/src/rtos/ChibiOS.c
@@ -103,7 +103,7 @@ static struct ChibiOS_params ChibiOS_params_list[] = {
 };
 #define CHIBIOS_NUM_PARAMS ((int)(sizeof(ChibiOS_params_list)/sizeof(struct 
ChibiOS_params)))
 
-static int ChibiOS_detect_rtos(struct target *target);
+static bool ChibiOS_detect_rtos(struct target *target);
 static int ChibiOS_create(struct target *target);
 static int ChibiOS_update_threads(struct rtos *rtos);
 static int ChibiOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, 
char **hex_reg_list);
@@ -510,7 +510,7 @@ static int 
ChibiOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
        return 0;
 }
 
-static int ChibiOS_detect_rtos(struct target *target)
+static bool ChibiOS_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        ((target->rtos->symbols[ChibiOS_VAL_rlist].address != 
0) ||
@@ -519,14 +519,14 @@ static int ChibiOS_detect_rtos(struct target *target)
                if (target->rtos->symbols[ChibiOS_VAL_ch_debug].address == 0) {
                        LOG_INFO("It looks like the target may be running 
ChibiOS "
                                        "without ch_debug.");
-                       return 0;
+                       return false;
                }
 
                /* looks like ChibiOS with memory map enabled.*/
-               return 1;
+               return true;
        }
 
-       return 0;
+       return false;
 }
 
 static int ChibiOS_create(struct target *target)
diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index 83961eb..6027d67 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -99,7 +99,7 @@ static const struct FreeRTOS_params FreeRTOS_params_list[] = {
 
 #define FREERTOS_NUM_PARAMS ((int)(sizeof(FreeRTOS_params_list)/sizeof(struct 
FreeRTOS_params)))
 
-static int FreeRTOS_detect_rtos(struct target *target);
+static bool FreeRTOS_detect_rtos(struct target *target);
 static int FreeRTOS_create(struct target *target);
 static int FreeRTOS_update_threads(struct rtos *rtos);
 static int FreeRTOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, 
char **hex_reg_list);
@@ -528,14 +528,14 @@ static int FreeRTOS_get_thread_ascii_info(struct rtos 
*rtos, threadid_t thread_i
 
 #endif
 
-static int FreeRTOS_detect_rtos(struct target *target)
+static bool FreeRTOS_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        
(target->rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address != 0)) {
                /* looks like FreeRTOS */
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 static int FreeRTOS_create(struct target *target)
diff --git a/src/rtos/ThreadX.c b/src/rtos/ThreadX.c
index ab8a66e..b7dbe6d 100644
--- a/src/rtos/ThreadX.c
+++ b/src/rtos/ThreadX.c
@@ -35,7 +35,7 @@ static const struct rtos_register_stacking 
*get_stacking_info_arm926ejs(const st
 static int is_thread_id_valid(const struct rtos *rtos, int64_t thread_id);
 static int is_thread_id_valid_arm926ejs(const struct rtos *rtos, int64_t 
thread_id);
 
-static int ThreadX_detect_rtos(struct target *target);
+static bool ThreadX_detect_rtos(struct target *target);
 static int ThreadX_create(struct target *target);
 static int ThreadX_update_threads(struct rtos *rtos);
 static int ThreadX_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, 
char **hex_reg_list);
@@ -492,14 +492,14 @@ static int 
ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
        return 0;
 }
 
-static int ThreadX_detect_rtos(struct target *target)
+static bool ThreadX_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        
(target->rtos->symbols[ThreadX_VAL_tx_thread_created_ptr].address != 0)) {
                /* looks like ThreadX */
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 #if 0
diff --git a/src/rtos/eCos.c b/src/rtos/eCos.c
index edc3d8b..9e41030 100644
--- a/src/rtos/eCos.c
+++ b/src/rtos/eCos.c
@@ -27,7 +27,7 @@
 #include "helper/types.h"
 #include "rtos_ecos_stackings.h"
 
-static int eCos_detect_rtos(struct target *target);
+static bool eCos_detect_rtos(struct target *target);
 static int eCos_create(struct target *target);
 static int eCos_update_threads(struct rtos *rtos);
 static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char 
**hex_reg_list);
@@ -363,14 +363,14 @@ static int 
eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
        return 0;
 }
 
-static int eCos_detect_rtos(struct target *target)
+static bool eCos_detect_rtos(struct target *target)
 {
        if ((target->rtos->symbols != NULL) &&
                        (target->rtos->symbols[eCos_VAL_thread_list].address != 
0)) {
                /* looks like eCos */
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 static int eCos_create(struct target *target)
diff --git a/src/rtos/embKernel.c b/src/rtos/embKernel.c
index e515383..a40c86c 100644
--- a/src/rtos/embKernel.c
+++ b/src/rtos/embKernel.c
@@ -31,7 +31,7 @@
 
 #define EMBKERNEL_MAX_THREAD_NAME_STR_SIZE (64)
 
-static int embKernel_detect_rtos(struct target *target);
+static bool embKernel_detect_rtos(struct target *target);
 static int embKernel_create(struct target *target);
 static int embKernel_update_threads(struct rtos *rtos);
 static int embKernel_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, 
char **hex_reg_list);
@@ -107,13 +107,13 @@ static const struct embKernel_params 
embKernel_params_list[] = {
                }
 };
 
-static int embKernel_detect_rtos(struct target *target)
+static bool embKernel_detect_rtos(struct target *target)
 {
        if (target->rtos->symbols != NULL) {
                if (target->rtos->symbols[SYMBOL_ID_sCurrentTask].address != 0)
-                       return 1;
+                       return true;
        }
-       return 0;
+       return false;
 }
 
 static int embKernel_create(struct target *target)
diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index 3efaab1..3b2a2b0 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -309,10 +309,10 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
        return ERROR_OK;
 }
 
-static int linux_os_detect(struct target *target)
+static bool linux_os_detect(struct target *target)
 {
        LOG_INFO("should no be called");
-       return 0;
+       return false;
 }
 
 static int linux_os_smp_init(struct target *target);
diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c
index 63a48c5..531b03b 100644
--- a/src/rtos/mqx.c
+++ b/src/rtos/mqx.c
@@ -244,9 +244,9 @@ static int mqx_is_scheduler_running(
 }
 
 /*
- * API function, return 1 if MQX is present
+ * API function, return true if MQX is present
  */
-static int mqx_detect_rtos(
+static bool mqx_detect_rtos(
        struct target *target
 )
 {
@@ -254,9 +254,9 @@ static int mqx_detect_rtos(
                (target->rtos->symbols != NULL) &&
                (target->rtos->symbols[mqx_VAL_mqx_kernel_data].address != 0)
        ) {
-               return 1;
+               return true;
        }
-       return 0;
+       return false;
 }
 
 /*
diff --git a/src/rtos/rtos.h b/src/rtos/rtos.h
index 70c1193..87aa502 100644
--- a/src/rtos/rtos.h
+++ b/src/rtos/rtos.h
@@ -59,7 +59,7 @@ struct rtos {
 
 struct rtos_type {
        const char *name;
-       int (*detect_rtos)(struct target *target);
+       bool (*detect_rtos)(struct target *target);
        int (*create)(struct target *target);
        int (*smp_init)(struct target *target);
        int (*update_threads)(struct rtos *rtos);
diff --git a/src/rtos/uCOS-III.c b/src/rtos/uCOS-III.c
index 0a0fb3e..8e63ea4 100644
--- a/src/rtos/uCOS-III.c
+++ b/src/rtos/uCOS-III.c
@@ -241,7 +241,7 @@ static int uCOS_III_update_thread_offsets(struct rtos *rtos)
        return ERROR_OK;
 }
 
-static int uCOS_III_detect_rtos(struct target *target)
+static bool uCOS_III_detect_rtos(struct target *target)
 {
        return target->rtos->symbols != NULL &&
                        target->rtos->symbols[uCOS_III_VAL_OSRunning].address 
!= 0;

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to