Date: Thu, 1 Aug 2013 12:05:23 +0000 (UTC) From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253858 - head/sys/netinet Message-ID: <201308011205.r71C5NgM081510@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308011205.r71C5NgM081510>