Date: Tue, 13 May 2014 17:05:38 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r265957 - stable/9/sys/netinet Message-ID: <201405131705.s4DH5csp085829@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405131705.s4DH5csp085829>