]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Simplify "i" definition in hostapd_config_free_bss()
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Wed, 19 Jun 2019 12:49:14 +0000 (15:49 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 23 Jun 2019 15:03:51 +0000 (18:03 +0300)
Declare the variable only once and reuse it instead of openning
unneeded scopes.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/ap/ap_config.c

index 48d09bcf9d121f71601529e21ad4778d3d288c3b..6a2deb6dea848771f27ddf33dc52a10e6dbf2351 100644 (file)
@@ -593,6 +593,10 @@ static void hostapd_dpp_controller_conf_free(struct dpp_controller_conf *conf)
 
 void hostapd_config_free_bss(struct hostapd_bss_config *conf)
 {
+#if defined(CONFIG_WPS) || defined(CONFIG_HS20)
+       size_t i;
+#endif
+
        if (conf == NULL)
                return;
 
@@ -685,12 +689,8 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        os_free(conf->model_description);
        os_free(conf->model_url);
        os_free(conf->upc);
-       {
-               unsigned int i;
-
-               for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
-                       wpabuf_free(conf->wps_vendor_ext[i]);
-       }
+       for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
+               wpabuf_free(conf->wps_vendor_ext[i]);
        wpabuf_free(conf->wps_nfc_dh_pubkey);
        wpabuf_free(conf->wps_nfc_dh_privkey);
        wpabuf_free(conf->wps_nfc_dev_pw);
@@ -716,7 +716,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
        os_free(conf->hs20_operating_class);
        os_free(conf->hs20_icons);
        if (conf->hs20_osu_providers) {
-               size_t i;
                for (i = 0; i < conf->hs20_osu_providers_count; i++) {
                        struct hs20_osu_provider *p;
                        size_t j;
@@ -734,8 +733,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
                os_free(conf->hs20_osu_providers);
        }
        if (conf->hs20_operator_icon) {
-               size_t i;
-
                for (i = 0; i < conf->hs20_operator_icon_count; i++)
                        os_free(conf->hs20_operator_icon[i]);
                os_free(conf->hs20_operator_icon);