iot/zoap: Fix retrieving the token for every reply

As there is only one response token, we can do this only once at the
beginning of the function, instead of every iteration.

Change-Id: Ibb324a1189929227bd1eb9837c5d330ff8c8dac2
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
This commit is contained in:
Vinicius Costa Gomes 2016-09-16 16:11:01 -03:00 committed by Anas Nashif
parent eab5adb282
commit 7d0a1279b6

View file

@ -547,14 +547,13 @@ struct zoap_reply *zoap_response_received(
struct zoap_reply *replies, size_t len)
{
struct zoap_reply *r;
const uint8_t *token;
uint8_t tkl;
size_t i;
token = zoap_header_get_token(response, &tkl);
for (i = 0, r = replies; i < len; i++, r++) {
const uint8_t *token;
uint8_t tkl;
token = zoap_header_get_token(response, &tkl);
if (r->tkl != tkl) {
continue;
}