From owner-svn-src-head@FreeBSD.ORG Tue Nov 22 02:50:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 528CC1065676; Tue, 22 Nov 2011 02:50:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4286D8FC18; Tue, 22 Nov 2011 02:50:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAM2oPbd070859; Tue, 22 Nov 2011 02:50:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAM2oPWC070856; Tue, 22 Nov 2011 02:50:25 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201111220250.pAM2oPWC070856@svn.freebsd.org> From: Eitan Adler Date: Tue, 22 Nov 2011 02:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227812 - head/lib/libc/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2011 02:50:25 -0000 Author: eadler (ports committer) Date: Tue Nov 22 02:50:24 2011 New Revision: 227812 URL: http://svn.freebsd.org/changeset/base/227812 Log: - fix some style(9) nits with my last commit - add a comment explaining why I used '|' instead of '||' Submitted by: danfe@ Approved by: emaste@ Modified: head/lib/libc/string/strcasecmp.c head/lib/libc/string/strncmp.c Modified: head/lib/libc/string/strcasecmp.c ============================================================================== --- head/lib/libc/string/strcasecmp.c Tue Nov 22 02:27:59 2011 (r227811) +++ head/lib/libc/string/strcasecmp.c Tue Nov 22 02:50:24 2011 (r227812) @@ -49,7 +49,7 @@ strcasecmp_l(const char *s1, const char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; if (s1 == s2) - return (0); + return (0); FIX_LOCALE(locale); @@ -73,8 +73,9 @@ strncasecmp_l(const char *s1, const char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; - if (( s1 == s2) | (n == 0)) - return (0); + /* use a bitwise or to avoid an additional branch instruction */ + if ((s1 == s2) | (n == 0)) + return (0); do { Modified: head/lib/libc/string/strncmp.c ============================================================================== --- head/lib/libc/string/strncmp.c Tue Nov 22 02:27:59 2011 (r227811) +++ head/lib/libc/string/strncmp.c Tue Nov 22 02:50:24 2011 (r227812) @@ -39,6 +39,7 @@ int strncmp(const char *s1, const char *s2, size_t n) { + /* use a bitwise or to avoid an additional branch instruction */ if ((n == 0) | (s1 == s2)) return (0);