Skip to content

Commit 83bd90e

Browse files
author
Jarkko Paso
committed
FHSS: fhss_struct defined static
1 parent 04ae3c3 commit 83bd90e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

source/Service_Libs/fhss/fhss.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ struct fhss_bs
6969
uint8_t beacons_received_timer;
7070
uint8_t broadcast_start_superframe;
7171
uint8_t synch_infos_sent_counter;
72-
bool tx_allowed;
73-
bool send_synch_info_on_next_broadcast_channel;
74-
bool beacon_received_on_this_bc_channel;
72+
bool tx_allowed:1;
73+
bool send_synch_info_on_next_broadcast_channel:1;
74+
bool beacon_received_on_this_bc_channel:1;
7575
uint16_t channel_list_counter;
7676
uint16_t synch_panid;
7777
uint32_t synch_interval;

source/Service_Libs/fhss/fhss_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#define TRACE_GROUP "fhssc"
3535

36-
fhss_structure_t *fhss_struct = 0;
36+
static fhss_structure_t *fhss_struct = NULL;
3737

3838
static void fhss_event_timer_cb(int8_t timer_id, uint16_t slots);
3939
static fhss_structure_t *fhss_get_object_with_timer_id(const int8_t timer_id);

test/nanostack/unittest/service_libs/fhss/test_fhss.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@
3131
#include "fhss_callbacks_stub.h"
3232
#include "fhss_beacon_tasklet_stub.h"
3333

34-
extern fhss_structure_t *fhss_struct;
34+
static fhss_api_t fhss_test_api;
35+
static fhss_timer_t fhss_test_timer;
36+
static fhss_structure_t *fhss_struct;
3537

3638

3739
static void test_alloc_fhss_struct(void)
3840
{
39-
fhss_struct = malloc(sizeof(fhss_structure_t));
41+
nsdynmemlib_stub.returnCounter += 1;
42+
fhss_struct = fhss_allocate_instance(&fhss_test_api, &fhss_test_timer);
4043
fhss_struct->bs = malloc(sizeof(fhss_bs_t));
4144
}
4245

0 commit comments

Comments
 (0)