From 53ff7dce43138c51df155995a6e80d67c8549758 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel Date: Mon, 25 Apr 2011 15:36:52 -0600 Subject: play with tweaks to yajl_string_scan: use ptrs to remove an inc in tight loop. --- src/yajl_lex.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') 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 -- cgit v1.2.1