Skip to content

Commit b3c5b3a

Browse files
aescolarkartben
authored andcommitted
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>
1 parent 1286f15 commit b3c5b3a

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

boards/native/nrf_bsim/common/bstests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct bst_test_instance {
9292
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
9393

9494
struct bst_test_list {
95-
struct bst_test_instance *test_instance;
95+
const struct bst_test_instance *test_instance;
9696
struct bst_test_list *next;
9797
};
9898

boards/native/nrf_bsim/common/bstests_entry.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
enum bst_result_t bst_result;
2323

24-
static struct bst_test_instance *current_test;
24+
static const struct bst_test_instance *current_test;
2525
static struct bst_test_list *test_list_top;
2626

2727
__attribute__((weak)) bst_test_install_t test_installers[] = { NULL };
@@ -42,25 +42,22 @@ struct bst_test_list *bst_add_tests(struct bst_test_list *tests,
4242
if (test_def[idx].test_id != NULL) {
4343
head = bs_malloc(sizeof(struct bst_test_list));
4444
head->next = NULL;
45-
head->test_instance = (struct bst_test_instance *)
46-
&test_def[idx++];
45+
head->test_instance = &test_def[idx++];
4746
tail = head;
4847
}
4948
}
5049

5150
while (test_def[idx].test_id != NULL) {
5251
tail->next = bs_malloc(sizeof(struct bst_test_list));
5352
tail = tail->next;
54-
tail->test_instance = (struct bst_test_instance *)
55-
&test_def[idx++];
53+
tail->test_instance = &test_def[idx++];
5654
tail->next = NULL;
5755
}
5856

5957
return head;
6058
}
6159

62-
static struct bst_test_instance *bst_test_find(struct bst_test_list *tests,
63-
char *test_id)
60+
static const struct bst_test_instance *bst_test_find(struct bst_test_list *tests, char *test_id)
6461
{
6562
struct bst_test_list *top = tests;
6663

0 commit comments

Comments
 (0)