| 479 | Return true if successful. */ |
| 480 | |
| 481 | static bool |
| 482 | get_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 | |
| 515 | static void |
| 516 | free_spareline (void) |
no test coverage detected