boards/native/nrf_bsim: Declare as pointer to constant data

To be clearer to the compiler and users.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2025-05-12 15:39:07 +02:00 committed by Benjamin Cabé
commit b3c5b3a7dc
2 changed files with 5 additions and 8 deletions

View file

@ -92,7 +92,7 @@ struct bst_test_instance {
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
struct bst_test_list {
struct bst_test_instance *test_instance;
const struct bst_test_instance *test_instance;
struct bst_test_list *next;
};

View file

@ -21,7 +21,7 @@
*/
enum bst_result_t bst_result;
static struct bst_test_instance *current_test;
static const struct bst_test_instance *current_test;
static struct bst_test_list *test_list_top;
__attribute__((weak)) bst_test_install_t test_installers[] = { NULL };
@ -42,8 +42,7 @@ struct bst_test_list *bst_add_tests(struct bst_test_list *tests,
if (test_def[idx].test_id != NULL) {
head = bs_malloc(sizeof(struct bst_test_list));
head->next = NULL;
head->test_instance = (struct bst_test_instance *)
&test_def[idx++];
head->test_instance = &test_def[idx++];
tail = head;
}
}
@ -51,16 +50,14 @@ struct bst_test_list *bst_add_tests(struct bst_test_list *tests,
while (test_def[idx].test_id != NULL) {
tail->next = bs_malloc(sizeof(struct bst_test_list));
tail = tail->next;
tail->test_instance = (struct bst_test_instance *)
&test_def[idx++];
tail->test_instance = &test_def[idx++];
tail->next = NULL;
}
return head;
}
static struct bst_test_instance *bst_test_find(struct bst_test_list *tests,
char *test_id)
static const struct bst_test_instance *bst_test_find(struct bst_test_list *tests, char *test_id)
{
struct bst_test_list *top = tests;