MCPcopy Index your code
hub / github.com/coreutils/coreutils / get_line

Function get_line

src/join.c:481–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479 Return true if successful. */
480
481static bool
482get_line (FILE *fp, struct line **linep, int which)
483{
484 struct line *line = *linep;
485
486 if (line == prevline[which - 1])
487 {
488 SWAPLINES (line, spareline[which - 1]);
489 *linep = line;
490 }
491
492 if (line)
493 reset_line (line);
494 else
495 line = init_linep (linep);
496
497 if (! readlinebuffer_delim (&line->buf, fp, eolchar))
498 {
499 if (ferror (fp))
500 error (EXIT_FAILURE, errno, _("read error"));
501 freeline (line);
502 return false;
503 }
504 ++line_no[which - 1];
505
506 xfields (line);
507
508 if (prevline[which - 1])
509 check_order (prevline[which - 1], line, which);
510
511 prevline[which - 1] = line;
512 return true;
513}
514
515static void
516free_spareline (void)

Callers 2

getseqFunction · 0.70
joinFunction · 0.70

Calls 5

reset_lineFunction · 0.85
init_linepFunction · 0.85
freelineFunction · 0.85
xfieldsFunction · 0.85
check_orderFunction · 0.70

Tested by

no test coverage detected