svn commit: r265957 - stable/9/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Tue May 13 17:05:38 UTC 2014
Author: tuexen
Date: Tue May 13 17:05:38 2014
New Revision: 265957
URL: http://svnweb.freebsd.org/changeset/base/265957
Log:
MFC r253858:
Micro-optimization suggested in
https://bugzilla.mozilla.org/show_bug.cgi?id=898234
by pchang9. While there simplify the code.
Modified:
stable/9/sys/netinet/sctp_usrreq.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/9/sys/netinet/sctp_usrreq.c Tue May 13 17:03:43 2014 (r265956)
+++ stable/9/sys/netinet/sctp_usrreq.c Tue May 13 17:05:38 2014 (r265957)
@@ -3942,7 +3942,6 @@ sctp_setopt(struct socket *so, int optna
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 optna
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;
More information about the svn-src-stable-9
mailing list