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 <matthias@blaicher.com> Reviewed-on: http://openocd.zylin.com/935 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
committed by
Peter Stuge
parent
a4dc39beb4
commit
3a6ac23716
@@ -31,6 +31,7 @@
|
||||
#include "target/target_type.h"
|
||||
#include "rtos.h"
|
||||
#include "helper/log.h"
|
||||
#include "helper/types.h"
|
||||
#include "rtos_chibios_stackings.h"
|
||||
|
||||
|
||||
@@ -132,8 +133,6 @@ static char *ChibiOS_symbol_list[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
#define CHIBIOS_NUM_SYMBOLS (sizeof(ChibiOS_symbol_list)/sizeof(char *))
|
||||
|
||||
static int ChibiOS_update_memory_signature(struct rtos *rtos)
|
||||
{
|
||||
int retval;
|
||||
@@ -483,9 +482,9 @@ static int ChibiOS_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) * CHIBIOS_NUM_SYMBOLS);
|
||||
sizeof(symbol_table_elem_t) * ARRAY_SIZE(ChibiOS_symbol_list));
|
||||
|
||||
for (i = 0; i < CHIBIOS_NUM_SYMBOLS; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(ChibiOS_symbol_list); i++)
|
||||
(*symbol_list)[i].symbol_name = ChibiOS_symbol_list[i];
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user