| 1439 | } |
| 1440 | |
| 1441 | static int should_lookahead(struct grep_opt *opt) |
| 1442 | { |
| 1443 | struct grep_pat *p; |
| 1444 | |
| 1445 | if (opt->pattern_expression) |
| 1446 | return 0; /* punt for too complex stuff */ |
| 1447 | if (opt->invert) |
| 1448 | return 0; |
| 1449 | for (p = opt->pattern_list; p; p = p->next) { |
| 1450 | if (p->token != GREP_PATTERN) |
| 1451 | return 0; /* punt for "header only" and stuff */ |
| 1452 | } |
| 1453 | return 1; |
| 1454 | } |
| 1455 | |
| 1456 | static int look_ahead(struct grep_opt *opt, |
| 1457 | unsigned long *left_p, |