aboutsummaryrefslogtreecommitdiffstats
path: root/src/wps
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-06-27 18:11:46 +0300
committerJouni Malinen <j@w1.fi>2012-06-27 21:22:12 +0300
commite524ebe387e1f1fd08bf5afece068abb8ddd4e3b (patch)
tree8fc6673d29dfa1b0ed7a03f1ba2ccaa9f5fdf9ea /src/wps
parenta0d0c560c3ded74ccb6f994d7608234f1bc24f18 (diff)
downloadexternal_wpa_supplicant_8_ti-e524ebe387e1f1fd08bf5afece068abb8ddd4e3b.zip
external_wpa_supplicant_8_ti-e524ebe387e1f1fd08bf5afece068abb8ddd4e3b.tar.gz
external_wpa_supplicant_8_ti-e524ebe387e1f1fd08bf5afece068abb8ddd4e3b.tar.bz2
NDEF: Skip unnecessary wpabuf to ptr/len conversion
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps')
-rw-r--r--src/wps/ndef.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wps/ndef.c b/src/wps/ndef.c
index 6128917..43412f7 100644
--- a/src/wps/ndef.c
+++ b/src/wps/ndef.c
@@ -97,13 +97,14 @@ static struct wpabuf * ndef_parse_records(struct wpabuf *buf,
static struct wpabuf * ndef_build_record(u8 flags, void *type,
u8 type_length, void *id,
- u8 id_length, void *payload,
- u32 payload_length)
+ u8 id_length,
+ const struct wpabuf *payload)
{
struct wpabuf *record;
size_t total_len;
int short_record;
u8 local_flag;
+ size_t payload_length = wpabuf_len(payload);
short_record = payload_length < 256 ? 1 : 0;
@@ -138,7 +139,7 @@ static struct wpabuf * ndef_build_record(u8 flags, void *type,
wpabuf_put_u8(record, id_length);
wpabuf_put_data(record, type, type_length);
wpabuf_put_data(record, id, id_length);
- wpabuf_put_data(record, payload, payload_length);
+ wpabuf_put_buf(record, payload);
return record;
}
@@ -164,6 +165,5 @@ struct wpabuf * ndef_build_wifi(struct wpabuf *buf)
{
return ndef_build_record(FLAG_MESSAGE_BEGIN | FLAG_MESSAGE_END |
FLAG_TNF_RFC2046, wifi_handover_type,
- os_strlen(wifi_handover_type), NULL, 0,
- wpabuf_mhead(buf), wpabuf_len(buf));
+ os_strlen(wifi_handover_type), NULL, 0, buf);
}