aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/config.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-06-29 21:50:40 (GMT)
committerJouni Malinen <j@w1.fi>2014-07-02 09:38:48 (GMT)
commit290ea6a76e5774591765bcf1eba86e56da5cdf00 (patch)
treead9da53c961b9698ccbce4ac7c0a921df7d3376e /wpa_supplicant/config.c
parentd3fa2bbb0278ffe34fc4486f04c4281a2b100c67 (diff)
downloadhostap-290ea6a76e5774591765bcf1eba86e56da5cdf00.zip
hostap-290ea6a76e5774591765bcf1eba86e56da5cdf00.tar.gz
hostap-290ea6a76e5774591765bcf1eba86e56da5cdf00.tar.bz2
Remove unnecessary tracking of first entry
The pointer to the current position is enough to figure out whether the proto string is the first one in the buffer. Removing the separate tracking variable cleans up a static analyzer warning on dead assignment. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/config.c')
-rw-r--r--wpa_supplicant/config.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 86d6d72..16031c9 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -435,7 +435,7 @@ static int wpa_config_parse_proto(const struct parse_data *data,
static char * wpa_config_write_proto(const struct parse_data *data,
struct wpa_ssid *ssid)
{
- int first = 1, ret;
+ int ret;
char *buf, *pos, *end;
pos = buf = os_zalloc(20);
@@ -444,27 +444,27 @@ static char * wpa_config_write_proto(const struct parse_data *data,
end = buf + 20;
if (ssid->proto & WPA_PROTO_WPA) {
- ret = os_snprintf(pos, end - pos, "%sWPA", first ? "" : " ");
+ ret = os_snprintf(pos, end - pos, "%sWPA",
+ pos == buf ? "" : " ");
if (ret < 0 || ret >= end - pos)
return buf;
pos += ret;
- first = 0;
}
if (ssid->proto & WPA_PROTO_RSN) {
- ret = os_snprintf(pos, end - pos, "%sRSN", first ? "" : " ");
+ ret = os_snprintf(pos, end - pos, "%sRSN",
+ pos == buf ? "" : " ");
if (ret < 0 || ret >= end - pos)
return buf;
pos += ret;
- first = 0;
}
if (ssid->proto & WPA_PROTO_OSEN) {
- ret = os_snprintf(pos, end - pos, "%sOSEN", first ? "" : " ");
+ ret = os_snprintf(pos, end - pos, "%sOSEN",
+ pos == buf ? "" : " ");
if (ret < 0 || ret >= end - pos)
return buf;
pos += ret;
- first = 0;
}
return buf;