From owner-svn-src-all@FreeBSD.ORG Sat Mar 13 00:15:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A728106566B; Sat, 13 Mar 2010 00:15:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 598E28FC17; Sat, 13 Mar 2010 00:15:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2D0F6UK055999; Sat, 13 Mar 2010 00:15:06 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2D0F6a6055997; Sat, 13 Mar 2010 00:15:06 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201003130015.o2D0F6a6055997@svn.freebsd.org> From: Xin LI Date: Sat, 13 Mar 2010 00:15:06 +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: r205108 - head/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 13 Mar 2010 00:15:06 -0000 Author: delphij Date: Sat Mar 13 00:15:06 2010 New Revision: 205108 URL: http://svn.freebsd.org/changeset/base/205108 Log: Correct bugs fixed but not merged from my own tree. Pointy hat to: delphij MFC after: 1 month Modified: head/lib/libc/string/strlen.c Modified: head/lib/libc/string/strlen.c ============================================================================== --- head/lib/libc/string/strlen.c Fri Mar 12 23:57:27 2010 (r205107) +++ head/lib/libc/string/strlen.c Sat Mar 13 00:15:06 2010 (r205108) @@ -99,14 +99,15 @@ strlen(const char *str) lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK); va = (*lp - mask01); vb = ((~*lp) & mask80); + lp++; if (va & vb) /* Check if we have \0 in the first part */ - for (p = str; (uintptr_t)p & LONGPTR_MASK; p++) + for (p = str; p < (const char *)lp; p++) if (*p == '\0') return (p - str); /* Scan the rest of the string using word sized operation */ - for (lp = (const unsigned long *)p; ; lp++) { + for (; ; lp++) { va = (*lp - mask01); vb = ((~*lp) & mask80); if (va & vb) {