summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2013-08-01 12:05:23 +0000
committertuexen <tuexen@FreeBSD.org>2013-08-01 12:05:23 +0000
commitcfbde726798816dad075d8f8eaa004eaf39ae511 (patch)
tree25b20a38fb5c718b2f14428c9aa5d30c60386837
parent027a033578e1b1cb345d2b449997bac41e6b1326 (diff)
downloadFreeBSD-src-cfbde726798816dad075d8f8eaa004eaf39ae511.zip
FreeBSD-src-cfbde726798816dad075d8f8eaa004eaf39ae511.tar.gz
Micro-optimization suggested in
https://bugzilla.mozilla.org/show_bug.cgi?id=898234 by pchang9. While there simplify the code. MFC after: 1 week
-rw-r--r--sys/netinet/sctp_usrreq.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 972ea23..d366985 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -3942,7 +3942,6 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
sctp_hmaclist_t *hmaclist;
uint16_t hmacid;
uint32_t i;
- size_t found;
SCTP_CHECK_AND_CAST(shmac, optval, struct sctp_hmacalgo, optsize);
if (optsize < sizeof(struct sctp_hmacalgo) + shmac->shmac_number_of_idents * sizeof(uint16_t)) {
@@ -3966,14 +3965,14 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
goto sctp_set_hmac_done;
}
}
- found = 0;
for (i = 0; i < hmaclist->num_algo; i++) {
if (hmaclist->hmac[i] == SCTP_AUTH_HMAC_ID_SHA1) {
/* already in list */
- found = 1;
+ break;
}
}
- if (!found) {
+ if (i == hmaclist->num_algo) {
+ /* not found in list */
sctp_free_hmaclist(hmaclist);
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
OpenPOWER on IntegriCloud