lloyd / yajl

A fast streaming JSON parsing library in C.
http://lloyd.github.com/yajl
ISC License
2.15k stars 435 forks source link

yajl_gen: use strspn instead of open loop #169

Open mathstuf opened 9 years ago

mathstuf commented 9 years ago

As discussed in #21.

mathstuf commented 8 years ago

Ping?

Jesin commented 7 years ago

No need to use strlen which does a second iteration from the beginning of the string. You can just say:

if (indent[strspn(indent, "\n\v\f\t\r ")]) {
    g->indentString = NULL;
    rv = 0;
}