| 1829 | } |
| 1830 | |
| 1831 | int grep_source(struct grep_opt *opt, struct grep_source *gs) |
| 1832 | { |
| 1833 | /* |
| 1834 | * we do not have to do the two-pass grep when we do not check |
| 1835 | * buffer-wide "all-match". |
| 1836 | */ |
| 1837 | if (!opt->all_match && !opt->no_body_match) |
| 1838 | return grep_source_1(opt, gs, 0); |
| 1839 | |
| 1840 | /* Otherwise the toplevel "or" terms hit a bit differently. |
| 1841 | * We first clear hit markers from them. |
| 1842 | */ |
| 1843 | clr_hit_marker(opt->pattern_expression); |
| 1844 | opt->body_hit = 0; |
| 1845 | grep_source_1(opt, gs, 1); |
| 1846 | |
| 1847 | if (opt->all_match && !chk_hit_marker(opt->pattern_expression)) |
| 1848 | return 0; |
| 1849 | if (opt->no_body_match && opt->body_hit) |
| 1850 | return 0; |
| 1851 | |
| 1852 | return grep_source_1(opt, gs, 0); |
| 1853 | } |
| 1854 | |
| 1855 | static void grep_source_init_buf(struct grep_source *gs, |
| 1856 | const char *buf, |
no test coverage detected