MCPcopy Create free account
hub / github.com/coreutils/coreutils / scan_mb_blank_field

Function scan_mb_blank_field

src/cut.c:499–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499static enum field_terminator
500scan_mb_blank_field (mbbuf_t *mbbuf, struct mbfield_parser *parser,
501 bool *have_pending_line, bool write_field,
502 idx_t *n_bytes)
503{
504 if (parser->trim_outer_whitespace && parser->at_line_start)
505 {
506 enum field_terminator terminator
507 = skip_whitespace_run (mbbuf, parser, have_pending_line, false);
508 if (terminator != FIELD_DATA)
509 return terminator;
510 }
511
512 parser->at_line_start = false;
513
514 while (true)
515 {
516 mcel_t g = mbbuf_get_saved_char (mbbuf, &parser->have_saved,
517 &parser->saved_g);
518 if (g.ch == MBBUF_EOF)
519 return FIELD_EOF;
520
521 *have_pending_line = true;
522
523 if (g.ch == line_delim)
524 return FIELD_LINE_DELIMITER;
525
526 if (mcel_isblank (g))
527 return skip_whitespace_run (mbbuf, parser, have_pending_line, true);
528
529 if (n_bytes)
530 append_field_1_bytes (mbbuf, g, n_bytes);
531 else if (write_field)
532 write_bytes (mbbuf_char_offset (mbbuf, g), g.len);
533 }
534}
535
536static enum field_terminator
537scan_mb_delim_field (mbbuf_t *mbbuf, bool *have_pending_line,

Callers 1

scan_mb_fieldFunction · 0.85

Calls 6

skip_whitespace_runFunction · 0.85
mbbuf_get_saved_charFunction · 0.85
mcel_isblankFunction · 0.85
append_field_1_bytesFunction · 0.85
write_bytesFunction · 0.85
mbbuf_char_offsetFunction · 0.85

Tested by

no test coverage detected