diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-09-20 16:41:28 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-09-20 16:41:28 -0400 |
commit | c86b0416025b4b3f8555295a89c64e233803fef2 (patch) | |
tree | 049326f9ca35449bcb96a3f9d19f9ebe1838a1ab | |
parent | libsandbox: rework abi syscall header generation (diff) | |
download | sandbox-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>
-rw-r--r-- | libsandbox/trace.c | 5 |
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; |