diff options
author | Michael Tuexen <tuexen@FreeBSD.org> | 2013-08-01 12:05:23 +0000 |
---|---|---|
committer | Michael Tuexen <tuexen@FreeBSD.org> | 2013-08-01 12:05:23 +0000 |
commit | bfd1666aad345fb88cef6a176a057078147a5c80 (patch) | |
tree | 25b20a38fb5c718b2f14428c9aa5d30c60386837 /sys/netinet | |
parent | dd5c5e7147429d0336fd7b49ac4b785f58ae481b (diff) | |
download | src-bfd1666aad345fb88cef6a176a057078147a5c80.tar.gz src-bfd1666aad345fb88cef6a176a057078147a5c80.zip |
Micro-optimization suggested in
https://bugzilla.mozilla.org/show_bug.cgi?id=898234
by pchang9. While there simplify the code.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=253858
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/sctp_usrreq.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 972ea23d1b71..d36698546d35 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; |