From owner-svn-src-all@FreeBSD.ORG Thu Aug 1 12:05:23 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AE3B06FE; Thu, 1 Aug 2013 12:05:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9B0532DC0; Thu, 1 Aug 2013 12:05:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r71C5NQa081511; Thu, 1 Aug 2013 12:05:23 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r71C5NgM081510; Thu, 1 Aug 2013 12:05:23 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201308011205.r71C5NgM081510@svn.freebsd.org> From: Michael Tuexen Date: Thu, 1 Aug 2013 12:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253858 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Aug 2013 12:05:23 -0000 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;