summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLloyd Hilaiel <lloyd@hilaiel.com>2011-04-25 15:36:52 -0600
committerLloyd Hilaiel <lloyd@hilaiel.com>2011-04-25 15:36:52 -0600
commit53ff7dce43138c51df155995a6e80d67c8549758 (patch)
tree8e360710a0b914c43a9d9d0311f5ec383fc0de1a
parentbb396891e9f43570b892804b9d7da3f6dd823fc3 (diff)
downloadyajl-lxrperf_ptrs.tar.gz
play with tweaks to yajl_string_scan: use ptrs to remove an inc in tight loop.lxrperf_ptrs
-rw-r--r--src/yajl_lex.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/yajl_lex.c b/src/yajl_lex.c
index b098e6a..a1c8719 100644
--- a/src/yajl_lex.c
+++ b/src/yajl_lex.c
@@ -255,13 +255,10 @@ static size_t
yajl_string_scan(const unsigned char * buf, size_t len, int utf8check)
{
unsigned char mask = IJC|NFP|(utf8check ? NUC : 0);
- size_t skip = 0;
- while (skip < len && !(charLookupTable[*buf] & mask))
- {
- skip++;
- buf++;
- }
- return skip;
+ const unsigned char * orig = buf;
+ const unsigned char * end = buf + len;
+ while (buf < end && !(charLookupTable[*buf] & mask)) buf++;
+ return buf - orig;
}
static yajl_tok