| 165 | } |
| 166 | |
| 167 | static void append_text_atom(char *buf, size_t bufsz, size_t *pos, const char *s) { |
| 168 | if (!s) { |
| 169 | return; |
| 170 | } |
| 171 | while (*s) { |
| 172 | unsigned char ch = (unsigned char)*s++; |
| 173 | if (ch <= ' ' || ch == 0x7f) { |
| 174 | append_char(buf, bufsz, pos, '_'); |
| 175 | } else { |
| 176 | append_char(buf, bufsz, pos, (char)ch); |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | static void append_json_string(char *buf, size_t bufsz, size_t *pos, const char *s) { |
| 182 | append_char(buf, bufsz, pos, '"'); |
no test coverage detected