aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-09-20 16:41:28 -0400
committerMike Frysinger <vapier@gentoo.org>2015-09-20 16:41:28 -0400
commitc86b0416025b4b3f8555295a89c64e233803fef2 (patch)
tree049326f9ca35449bcb96a3f9d19f9ebe1838a1ab /libsandbox
parentlibsandbox: rework abi syscall header generation (diff)
downloadsandbox-c86b0416025b4b3f8555295a89c64e233803fef2.tar.gz
sandbox-c86b0416025b4b3f8555295a89c64e233803fef2.tar.bz2
sandbox-c86b0416025b4b3f8555295a89c64e233803fef2.zip
libsandbox: use memchr to speed up NUL byte search
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox')
-rw-r--r--libsandbox/trace.c5
1 files 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;