- while ((esc = strpbrk(str, "\\\a\b\t\n\v\f\r\""))) {
- if (esc != str)
- saxdb_put_nchars(dest, str, esc-str);
- saxdb_put_char(dest, '\\');
- switch (*esc) {
- case '\a': saxdb_put_char(dest, 'a'); break;
- case '\b': saxdb_put_char(dest, 'b'); break;
- case '\t': saxdb_put_char(dest, 't'); break;
- case '\n': saxdb_put_char(dest, 'n'); break;
- case '\v': saxdb_put_char(dest, 'v'); break;
- case '\f': saxdb_put_char(dest, 'f'); break;
- case '\r': saxdb_put_char(dest, 'r'); break;
- case '\\': saxdb_put_char(dest, '\\'); break;
- case '"': saxdb_put_char(dest, '"'); break;
+ for (ofs = 0; str[ofs] != '\0'; ) {
+ char stop;
+ span = strcspn(str + ofs, "\\\a\b\t\n\v\f\r\"");
+ saxdb_put_nchars(dest, str + ofs, span);
+ ofs += span;
+ stop = str[ofs];
+ switch (stop) {
+ case '\0': continue;
+ case '\a': stop = 'a'; break;
+ case '\b': stop = 'b'; break;
+ case '\t': stop = 't'; break;
+ case '\n': stop = 'n'; break;
+ case '\v': stop = 'v'; break;
+ case '\f': stop = 'f'; break;
+ case '\r': stop = 'r'; break;