Use bzero instead of {} for initializing structs

master
Ismael Gomez 7 years ago
parent 8beb3cab10
commit 4662b83fe9

@ -63,7 +63,8 @@ private:
get_time_interval(sleep_period_start); get_time_interval(sleep_period_start);
uint32_t period = sleep_period_start[0].tv_sec*1e6 + sleep_period_start[0].tv_usec; uint32_t period = sleep_period_start[0].tv_sec*1e6 + sleep_period_start[0].tv_usec;
if (m) { if (m) {
metrics_t metric = {}; metrics_t metric;
bzero(&metric, sizeof(metrics_t));
m->get_metrics(metric); m->get_metrics(metric);
for (uint32_t i=0;i<listeners.size();i++) { for (uint32_t i=0;i<listeners.size();i++) {
listeners[i]->set_metrics(metric, period); listeners[i]->set_metrics(metric, period);

@ -147,7 +147,7 @@ typedef struct {
int main(int argc, char **argv) { int main(int argc, char **argv) {
srslte_pdcch_t pdcch_tx, pdcch_rx; srslte_pdcch_t pdcch_tx, pdcch_rx;
testcase_dci_t testcases[10] = {}; testcase_dci_t testcases[10];
srslte_ra_dl_dci_t ra_dl; srslte_ra_dl_dci_t ra_dl;
srslte_regs_t regs; srslte_regs_t regs;
int i, j, k; int i, j, k;

@ -108,7 +108,8 @@ class cell_t
} }
cell_t() { cell_t() {
phy_interface_rrc::phy_cell_t tmp = {}; phy_interface_rrc::phy_cell_t tmp;
ZERO_OBJECT(tmp);
cell_t(tmp, 0); cell_t(tmp, 0);
} }
cell_t(phy_interface_rrc::phy_cell_t phy_cell, float rsrp) { cell_t(phy_interface_rrc::phy_cell_t phy_cell, float rsrp) {

@ -251,12 +251,16 @@ void phch_worker::work_imp()
bool ul_grant_available = false; bool ul_grant_available = false;
bool dl_ack[SRSLTE_MAX_CODEWORDS] = {false}; bool dl_ack[SRSLTE_MAX_CODEWORDS] = {false};
mac_interface_phy::mac_grant_t dl_mac_grant = {}; mac_interface_phy::mac_grant_t dl_mac_grant;
mac_interface_phy::tb_action_dl_t dl_action = {}; mac_interface_phy::tb_action_dl_t dl_action;
mac_interface_phy::mac_grant_t ul_mac_grant = {}; mac_interface_phy::mac_grant_t ul_mac_grant;
mac_interface_phy::tb_action_ul_t ul_action = {}; mac_interface_phy::tb_action_ul_t ul_action;
ZERO_OBJECT(dl_mac_grant);
ZERO_OBJECT(dl_action);
ZERO_OBJECT(ul_mac_grant);
ZERO_OBJECT(ul_action);
/** Calculate RSSI on the input signal before generating the output */ /** Calculate RSSI on the input signal before generating the output */

@ -1244,7 +1244,8 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id) {
16 /* data value */ + 16 /* data value */ +
cfg.user.length(); cfg.user.length();
uint8_t challenge[len] = {}; uint8_t challenge[len];
bzero(challenge, len*sizeof(uint8_t));
challenge[0] = 0x01; // challenge code challenge[0] = 0x01; // challenge code
challenge[1] = chap_id; // ID challenge[1] = chap_id; // ID
challenge[2] = (len >> 8) & 0xff; challenge[2] = (len >> 8) & 0xff;
@ -1263,7 +1264,8 @@ void nas::send_esm_information_response(const uint8 proc_transaction_id) {
} }
// Generate response // Generate response
uint8_t response[len] = {}; uint8_t response[len];
bzero(response, len*sizeof(uint8_t));
response[0] = 0x02; // response code response[0] = 0x02; // response code
response[1] = chap_id; response[1] = chap_id;
response[2] = (len >> 8) & 0xff; response[2] = (len >> 8) & 0xff;

Loading…
Cancel
Save