| 1669 | } |
| 1670 | |
| 1671 | static void record_ws_error(struct apply_state *state, |
| 1672 | unsigned result, |
| 1673 | const char *line, |
| 1674 | int len, |
| 1675 | int linenr) |
| 1676 | { |
| 1677 | char *err; |
| 1678 | |
| 1679 | if (!result) |
| 1680 | return; |
| 1681 | |
| 1682 | state->whitespace_error++; |
| 1683 | if (state->squelch_whitespace_errors && |
| 1684 | state->squelch_whitespace_errors < state->whitespace_error) |
| 1685 | return; |
| 1686 | |
| 1687 | /* |
| 1688 | * line[len] for an incomplete line points at the "\n" at the end |
| 1689 | * of patch input line, so "%.*s" would drop the last letter on line; |
| 1690 | * compensate for it. |
| 1691 | */ |
| 1692 | if (result & WS_INCOMPLETE_LINE) |
| 1693 | len++; |
| 1694 | |
| 1695 | err = whitespace_error_string(result); |
| 1696 | if (state->apply_verbosity > verbosity_silent) |
| 1697 | fprintf(stderr, "%s:%d: %s.\n%.*s\n", |
| 1698 | state->patch_input_file, linenr, err, len, line); |
| 1699 | free(err); |
| 1700 | } |
| 1701 | |
| 1702 | static void check_whitespace(struct apply_state *state, |
| 1703 | const char *line, |
no test coverage detected