From patchwork Wed Jun 19 12:49:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1118524 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qS+mCwaF"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45THPT6DV7z9s6w for ; Wed, 19 Jun 2019 17:58:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=E+EStkWZqyEquHUujN0adRBZLdhjgUl7wjWvPkvy6QU=; b=qS+mCwaFZd/BxI YS09Btfh1XUE7JG+nx9W0EXgeeMPzqUGzmlTzN1gWbu2ASlGjbp+9tS7VsdogOEYNRz/kfKONwcTx 091yWPoW4+uKcYYDzBcEQGzJpJHUc6Ldzr9rwYmaz3QJl/e9pyE4n60wDjoNrxNVdRMZ8xu0Z35+U bUsB0a/LLUdaQwGL3J807AkpQznHAzEJQUWkiEqoAItKqNT88BWRv9fV3RDizMcw7XPmNpFrPqm+c xRlBjZlGLI0kF3QOzZJOKTqM6A/RjVT7OgZNqNxm2WTvlAB8pfbgGf5EMaFX5eUYmSMemAcPCF+F6 O5FYcRE221llNeu1fr7Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdVTm-0007j4-21; Wed, 19 Jun 2019 07:58:02 +0000 Received: from mga17.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdVSl-0006ZZ-Az for hostap@lists.infradead.org; Wed, 19 Jun 2019 07:57:00 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 00:56:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,392,1557212400"; d="scan'208";a="358537334" Received: from andrei-xps-12-9q33.jer.intel.com ([10.12.190.53]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2019 00:56:57 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH 4/6] AP: Simplify "i" definition in hostapd_config_free_bss() Date: Wed, 19 Jun 2019 15:49:14 +0300 Message-Id: <20190619124916.14150-5-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_005659_444518_EED315DD X-CRM114-Status: GOOD ( 10.71 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Otcheretianski Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Declare the variable only once and reuse it instead of openning unneeded scopes. Signed-off-by: Andrei Otcheretianski --- src/ap/ap_config.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 48d09bcf9d..5f0f2e0da7 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -593,6 +593,8 @@ static void hostapd_dpp_controller_conf_free(struct dpp_controller_conf *conf) void hostapd_config_free_bss(struct hostapd_bss_config *conf) { + size_t i; + if (conf == NULL) return; @@ -685,12 +687,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 +714,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 +731,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);