From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id EF02F13881D for ; Sun, 27 Sep 2015 06:13:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E452721C038; Sun, 27 Sep 2015 06:13:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3FEB521C038 for ; Sun, 27 Sep 2015 06:13:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 69CAA340DF5 for ; Sun, 27 Sep 2015 06:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AC76D235 for ; Sun, 27 Sep 2015 06:13:26 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1442781688.c86b0416025b4b3f8555295a89c64e233803fef2.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/trace.c X-VCS-Directories: libsandbox/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: c86b0416025b4b3f8555295a89c64e233803fef2 X-VCS-Branch: master Date: Sun, 27 Sep 2015 06:13:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f54b9d47-3f02-454d-ad27-22cfa6cb5c47 X-Archives-Hash: b8613b9d214a8783f43b6da0848970ba commit: c86b0416025b4b3f8555295a89c64e233803fef2 Author: Mike Frysinger gentoo org> AuthorDate: Sun Sep 20 20:41:28 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sun Sep 20 20:41:28 2015 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=c86b0416 libsandbox: use memchr to speed up NUL byte search Signed-off-by: Mike Frysinger gentoo.org> libsandbox/trace.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libsandbox/trace.c b/libsandbox/trace.c index ed05c4d..47d2bdf 100644 --- a/libsandbox/trace.c +++ b/libsandbox/trace.c @@ -123,9 +123,8 @@ static char *do_peekstr(unsigned long lptr) strerror(e)); } - for (i = 0; i < liov.iov_len; ++i) - if (!((char *)liov.iov_base)[i]) - return ret; + if (memchr(liov.iov_base, '\0', liov.iov_len) != NULL) + return ret; riov.iov_base += l; riov.iov_len = liov.iov_len = l; len += l;