diff options
Diffstat (limited to 'src/yajl_lex.c')
-rw-r--r-- | src/yajl_lex.c | 11 |
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 |