svn commit: r253858 - head/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Thu Aug 1 12:05:23 UTC 2013
Author: tuexen
Date: Thu Aug 1 12:05:23 2013
New Revision: 253858
URL: http://svnweb.freebsd.org/changeset/base/253858
Log:
Micro-optimization suggested in
https://bugzilla.mozilla.org/show_bug.cgi?id=898234
by pchang9. While there simplify the code.
MFC after: 1 week
Modified:
head/sys/netinet/sctp_usrreq.c
Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c Thu Aug 1 10:06:19 2013 (r253857)
+++ head/sys/netinet/sctp_usrreq.c Thu Aug 1 12:05:23 2013 (r253858)
@@ -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-all
mailing list