WNM: Remove unnecessary present flag

The structures are all allocated, so the pointer can be compared to NULL
to determine whether the subelement was present.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-04-08 01:34:17 +03:00 committed by Jouni Malinen
parent f6ce70dc0d
commit 897a5ccee8
2 changed files with 0 additions and 16 deletions

View File

@ -338,7 +338,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
rep->tsf_info = os_zalloc(sizeof(struct tsf_info)); rep->tsf_info = os_zalloc(sizeof(struct tsf_info));
if (rep->tsf_info == NULL) if (rep->tsf_info == NULL)
break; break;
rep->tsf_info->present = 1;
os_memcpy(rep->tsf_info->tsf_offset, pos, 2); os_memcpy(rep->tsf_info->tsf_offset, pos, 2);
os_memcpy(rep->tsf_info->beacon_interval, pos + 2, 2); os_memcpy(rep->tsf_info->beacon_interval, pos + 2, 2);
break; break;
@ -353,7 +352,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
os_zalloc(sizeof(struct condensed_country_string)); os_zalloc(sizeof(struct condensed_country_string));
if (rep->con_coun_str == NULL) if (rep->con_coun_str == NULL)
break; break;
rep->con_coun_str->present = 1;
os_memcpy(rep->con_coun_str->country_string, pos, 2); os_memcpy(rep->con_coun_str->country_string, pos, 2);
break; break;
case WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE: case WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE:
@ -367,7 +365,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
os_zalloc(sizeof(struct bss_transition_candidate)); os_zalloc(sizeof(struct bss_transition_candidate));
if (rep->bss_tran_can == NULL) if (rep->bss_tran_can == NULL)
break; break;
rep->bss_tran_can->present = 1;
rep->bss_tran_can->preference = pos[0]; rep->bss_tran_can->preference = pos[0];
break; break;
case WNM_NEIGHBOR_BSS_TERMINATION_DURATION: case WNM_NEIGHBOR_BSS_TERMINATION_DURATION:
@ -381,7 +378,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
os_zalloc(sizeof(struct bss_termination_duration)); os_zalloc(sizeof(struct bss_termination_duration));
if (rep->bss_term_dur == NULL) if (rep->bss_term_dur == NULL)
break; break;
rep->bss_term_dur->present = 1;
os_memcpy(rep->bss_term_dur->duration, pos, 10); os_memcpy(rep->bss_term_dur->duration, pos, 10);
break; break;
case WNM_NEIGHBOR_BEARING: case WNM_NEIGHBOR_BEARING:
@ -394,7 +390,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
rep->bearing = os_zalloc(sizeof(struct bearing)); rep->bearing = os_zalloc(sizeof(struct bearing));
if (rep->bearing == NULL) if (rep->bearing == NULL)
break; break;
rep->bearing->present = 1;
os_memcpy(rep->bearing->bearing, pos, 8); os_memcpy(rep->bearing->bearing, pos, 8);
break; break;
case WNM_NEIGHBOR_MEASUREMENT_PILOT: case WNM_NEIGHBOR_MEASUREMENT_PILOT:
@ -407,7 +402,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
rep->meas_pilot = os_zalloc(sizeof(struct measurement_pilot)); rep->meas_pilot = os_zalloc(sizeof(struct measurement_pilot));
if (rep->meas_pilot == NULL) if (rep->meas_pilot == NULL)
break; break;
rep->meas_pilot->present = 1;
rep->meas_pilot->measurement_pilot = pos[0]; rep->meas_pilot->measurement_pilot = pos[0];
rep->meas_pilot->subelem_len = elen - 1; rep->meas_pilot->subelem_len = elen - 1;
os_memcpy(rep->meas_pilot->subelems, pos + 1, elen - 1); os_memcpy(rep->meas_pilot->subelems, pos + 1, elen - 1);
@ -423,7 +417,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
os_zalloc(sizeof(struct rrm_enabled_capabilities)); os_zalloc(sizeof(struct rrm_enabled_capabilities));
if (rep->rrm_cap == NULL) if (rep->rrm_cap == NULL)
break; break;
rep->rrm_cap->present = 1;
os_memcpy(rep->rrm_cap->capabilities, pos, 5); os_memcpy(rep->rrm_cap->capabilities, pos, 5);
break; break;
case WNM_NEIGHBOR_MULTIPLE_BSSID: case WNM_NEIGHBOR_MULTIPLE_BSSID:
@ -435,7 +428,6 @@ static void wnm_parse_neighbor_report_elem(struct neighbor_report *rep,
rep->mul_bssid = os_zalloc(sizeof(struct multiple_bssid)); rep->mul_bssid = os_zalloc(sizeof(struct multiple_bssid));
if (rep->mul_bssid == NULL) if (rep->mul_bssid == NULL)
break; break;
rep->mul_bssid->present = 1;
rep->mul_bssid->max_bssid_indicator = pos[0]; rep->mul_bssid->max_bssid_indicator = pos[0];
rep->mul_bssid->subelem_len = elen - 1; rep->mul_bssid->subelem_len = elen - 1;
os_memcpy(rep->mul_bssid->subelems, pos + 1, elen - 1); os_memcpy(rep->mul_bssid->subelems, pos + 1, elen - 1);

View File

@ -10,45 +10,37 @@
#define WNM_STA_H #define WNM_STA_H
struct tsf_info { struct tsf_info {
u8 present;
u8 tsf_offset[2]; u8 tsf_offset[2];
u8 beacon_interval[2]; u8 beacon_interval[2];
}; };
struct condensed_country_string { struct condensed_country_string {
u8 present;
u8 country_string[2]; u8 country_string[2];
}; };
struct bss_transition_candidate { struct bss_transition_candidate {
u8 present;
u8 preference; u8 preference;
}; };
struct bss_termination_duration { struct bss_termination_duration {
u8 present;
u8 duration[10]; u8 duration[10];
}; };
struct bearing { struct bearing {
u8 present;
u8 bearing[8]; u8 bearing[8];
}; };
struct measurement_pilot { struct measurement_pilot {
u8 present;
u8 measurement_pilot; u8 measurement_pilot;
u8 subelem_len; u8 subelem_len;
u8 subelems[255]; u8 subelems[255];
}; };
struct rrm_enabled_capabilities { struct rrm_enabled_capabilities {
u8 present;
u8 capabilities[5]; u8 capabilities[5];
}; };
struct multiple_bssid { struct multiple_bssid {
u8 present;
u8 max_bssid_indicator; u8 max_bssid_indicator;
u8 subelem_len; u8 subelem_len;
u8 subelems[255]; u8 subelems[255];