Use bzero instead of {} for initializing structs

This commit is contained in:
Ismael Gomez 2018-05-22 15:14:03 +02:00
parent 8beb3cab10
commit 4662b83fe9
5 changed files with 17 additions and 9 deletions

View File

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

View File

@ -147,7 +147,7 @@ typedef struct {
int main(int argc, char **argv) {
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_regs_t regs;
int i, j, k;

View File

@ -108,7 +108,8 @@ class 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(phy_interface_rrc::phy_cell_t phy_cell, float rsrp) {

View File

@ -251,12 +251,16 @@ void phch_worker::work_imp()
bool ul_grant_available = false;
bool dl_ack[SRSLTE_MAX_CODEWORDS] = {false};
mac_interface_phy::mac_grant_t dl_mac_grant = {};
mac_interface_phy::tb_action_dl_t dl_action = {};
mac_interface_phy::mac_grant_t dl_mac_grant;
mac_interface_phy::tb_action_dl_t dl_action;
mac_interface_phy::mac_grant_t ul_mac_grant = {};
mac_interface_phy::tb_action_ul_t ul_action = {};
mac_interface_phy::mac_grant_t ul_mac_grant;
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 */

View File

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