| 367 | } |
| 368 | |
| 369 | static inline enum field_terminator |
| 370 | skip_whitespace_run (mbbuf_t *mbuf, struct mbfield_parser *parser, |
| 371 | bool *have_pending_line, |
| 372 | bool have_initial_whitespace) |
| 373 | { |
| 374 | mcel_t g; |
| 375 | |
| 376 | do |
| 377 | { |
| 378 | g = mbbuf_get_char (mbuf); |
| 379 | if (g.ch != MBBUF_EOF) |
| 380 | *have_pending_line = true; |
| 381 | } |
| 382 | while (g.ch != MBBUF_EOF && g.ch != line_delim && mcel_isblank (g)); |
| 383 | |
| 384 | bool trim_start = parser->trim_outer_whitespace && parser->at_line_start; |
| 385 | |
| 386 | if (parser->trim_outer_whitespace |
| 387 | && (g.ch == MBBUF_EOF || g.ch == line_delim)) |
| 388 | { |
| 389 | return g.ch == MBBUF_EOF ? FIELD_EOF : FIELD_LINE_DELIMITER; |
| 390 | } |
| 391 | |
| 392 | parser->saved_g = g; |
| 393 | parser->have_saved = true; |
| 394 | return trim_start && !have_initial_whitespace ? FIELD_DATA : FIELD_DELIMITER; |
| 395 | } |
| 396 | |
| 397 | /* Like fwrite, but avoid a function call for smaller amounts, |
| 398 | and exit immediately upon error. */ |
no test coverage detected