| 3553 | } |
| 3554 | |
| 3555 | static int checkdiff_consume(void *priv, char *line, unsigned long len) |
| 3556 | { |
| 3557 | struct checkdiff_t *data = priv; |
| 3558 | int last_line_kind; |
| 3559 | int marker_size = data->conflict_marker_size; |
| 3560 | const char *ws = diff_get_color(data->o->use_color, DIFF_WHITESPACE); |
| 3561 | const char *reset = diff_get_color(data->o->use_color, DIFF_RESET); |
| 3562 | const char *set = diff_get_color(data->o->use_color, DIFF_FILE_NEW); |
| 3563 | char *err; |
| 3564 | const char *line_prefix; |
| 3565 | |
| 3566 | assert(data->o); |
| 3567 | line_prefix = diff_line_prefix(data->o); |
| 3568 | |
| 3569 | last_line_kind = data->last_line_kind; |
| 3570 | data->last_line_kind = line[0]; |
| 3571 | if (line[0] == '+') { |
| 3572 | unsigned bad; |
| 3573 | data->lineno++; |
| 3574 | if (is_conflict_marker(line + 1, marker_size, len - 1)) { |
| 3575 | data->status |= 1; |
| 3576 | fprintf(data->o->file, |
| 3577 | "%s%s:%d: leftover conflict marker\n", |
| 3578 | line_prefix, data->filename, data->lineno); |
| 3579 | } |
| 3580 | bad = ws_check(line + 1, len - 1, data->ws_rule); |
| 3581 | if (!bad) |
| 3582 | return 0; |
| 3583 | data->status |= bad; |
| 3584 | err = whitespace_error_string(bad); |
| 3585 | fprintf(data->o->file, "%s%s:%d: %s.\n", |
| 3586 | line_prefix, data->filename, data->lineno, err); |
| 3587 | free(err); |
| 3588 | emit_line(data->o, set, reset, line, 1); |
| 3589 | ws_check_emit(line + 1, len - 1, data->ws_rule, |
| 3590 | data->o->file, set, reset, ws); |
| 3591 | } else if (line[0] == ' ') { |
| 3592 | data->lineno++; |
| 3593 | } else if (line[0] == '\\') { |
| 3594 | /* no newline at the end of the line */ |
| 3595 | if ((data->ws_rule & WS_INCOMPLETE_LINE) && |
| 3596 | (last_line_kind == '+')) { |
| 3597 | unsigned bad = WS_INCOMPLETE_LINE; |
| 3598 | data->status |= bad; |
| 3599 | err = whitespace_error_string(bad); |
| 3600 | fprintf(data->o->file, "%s%s:%d: %s.\n", |
| 3601 | line_prefix, data->filename, data->lineno, err); |
| 3602 | free(err); |
| 3603 | } |
| 3604 | } |
| 3605 | return 0; |
| 3606 | } |
| 3607 | |
| 3608 | static unsigned char *deflate_it(char *data, |
| 3609 | unsigned long size, |
nothing calls this directly
no test coverage detected