From 3a6ac237163b9a2c480c020064aabf4c2b199543 Mon Sep 17 00:00:00 2001 From: Matthias Blaicher Date: Sat, 27 Oct 2012 17:21:24 +0200 Subject: rtos: Use ARRAY_SIZE instead of coding it by hand Use ARRAY_SIZE in helper/types.h to determine the size of the symbol list. Change-Id: Icc9838323510f8602efa5d0162a4daed33f863b9 Signed-off-by: Matthias Blaicher Reviewed-on: http://openocd.zylin.com/935 Tested-by: jenkins Reviewed-by: Peter Stuge --- src/rtos/FreeRTOS.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/rtos/FreeRTOS.c') diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c index 2295d745..5ca4ce95 100644 --- a/src/rtos/FreeRTOS.c +++ b/src/rtos/FreeRTOS.c @@ -28,6 +28,7 @@ #include "target/target_type.h" #include "rtos.h" #include "helper/log.h" +#include "helper/types.h" #include "rtos_standard_stackings.h" #define FREERTOS_MAX_PRIORITIES 63 @@ -121,8 +122,6 @@ static char *FreeRTOS_symbol_list[] = { NULL }; -#define FREERTOS_NUM_SYMBOLS (sizeof(FreeRTOS_symbol_list)/sizeof(char *)) - /* TODO: */ /* this is not safe for little endian yet */ /* may be problems reading if sizes are not 32 bit long integers. */ @@ -399,9 +398,9 @@ static int FreeRTOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[] { unsigned int i; *symbol_list = (symbol_table_elem_t *) malloc( - sizeof(symbol_table_elem_t) * FREERTOS_NUM_SYMBOLS); + sizeof(symbol_table_elem_t) * ARRAY_SIZE(FreeRTOS_symbol_list)); - for (i = 0; i < FREERTOS_NUM_SYMBOLS; i++) + for (i = 0; i < ARRAY_SIZE(FreeRTOS_symbol_list); i++) (*symbol_list)[i].symbol_name = FreeRTOS_symbol_list[i]; return 0; -- cgit v1.2.3-18-g5258