1410
return hit;
1411
}
1412
1413
-static void show_line(struct grep_opt *opt, char *bol, char *eol,
1414
- const char *name, unsigned lno, ssize_t cno, char sign)
1413
+static void show_line_header(struct grep_opt *opt, const char *name,
1414
+ unsigned lno, ssize_t cno, char sign)
1415
{
1416
- int rest = eol - bol;
1417
- const char *match_color, *line_color = NULL;
1418
-
1419
- if (opt->file_break && opt->last_shown == 0) {
1420
- if (opt->show_hunk_mark)
1421
- opt->output(opt, "\n", 1);
1422
- } else if (opt->pre_context || opt->post_context || opt->funcbody) {
1423
- if (opt->last_shown == 0) {
1424
- if (opt->show_hunk_mark) {
1425
- output_color(opt, "--", 2, opt->color_sep);
1426
- opt->output(opt, "\n", 1);
1427
- }
1428
- } else if (lno > opt->last_shown + 1) {
1429
- output_color(opt, "--", 2, opt->color_sep);
1430
- opt->output(opt, "\n", 1);
1431
- }
1432
- }
1416
if (opt->heading && opt->last_shown == 0) {
1417
output_color(opt, name, strlen(name), opt->color_filename);
1418
opt->output(opt, "\n", 1);
1440
output_color(opt, buf, strlen(buf), opt->color_columnno);
1441
output_sep(opt, sign);
1442
}
1443
+}
1444
+
1445
+static void show_line(struct grep_opt *opt, char *bol, char *eol,
1446
+ const char *name, unsigned lno, ssize_t cno, char sign)
1447
+{
1448
+ int rest = eol - bol;
1449
+ const char *match_color, *line_color = NULL;
1450
+
1451
+ if (opt->file_break && opt->last_shown == 0) {
1452
+ if (opt->show_hunk_mark)
1453
+ opt->output(opt, "\n", 1);
1454
+ } else if (opt->pre_context || opt->post_context || opt->funcbody) {
1455
+ if (opt->last_shown == 0) {
1456
+ if (opt->show_hunk_mark) {
1457
+ output_color(opt, "--", 2, opt->color_sep);
1458
+ opt->output(opt, "\n", 1);
1459
+ }
1460
+ } else if (lno > opt->last_shown + 1) {
1461
+ output_color(opt, "--", 2, opt->color_sep);
1462
+ opt->output(opt, "\n", 1);
1463
+ }
1464
+ }
1465
+ show_line_header(opt, name, lno, cno, sign);
1466
if (opt->color) {
1467
regmatch_t match;
1468
enum grep_context ctx = GREP_CONTEXT_BODY;