| 41 | } |
| 42 | |
| 43 | static int diff_grep(mmfile_t *one, mmfile_t *two, |
| 44 | struct diff_options *o, |
| 45 | regex_t *regexp, kwset_t kws UNUSED) |
| 46 | { |
| 47 | struct diffgrep_cb ecbdata; |
| 48 | xpparam_t xpp; |
| 49 | xdemitconf_t xecfg; |
| 50 | int ret; |
| 51 | |
| 52 | /* |
| 53 | * We have both sides; need to run textual diff and see if |
| 54 | * the pattern appears on added/deleted lines. |
| 55 | */ |
| 56 | memset(&xpp, 0, sizeof(xpp)); |
| 57 | memset(&xecfg, 0, sizeof(xecfg)); |
| 58 | ecbdata.regexp = regexp; |
| 59 | ecbdata.hit = 0; |
| 60 | xecfg.flags = XDL_EMIT_NO_HUNK_HDR; |
| 61 | xecfg.ctxlen = o->context; |
| 62 | xecfg.interhunkctxlen = o->interhunkcontext; |
| 63 | |
| 64 | /* |
| 65 | * An xdiff error might be our "data->hit" from above. See the |
| 66 | * comment for xdiff_emit_line_fn in xdiff-interface.h |
| 67 | */ |
| 68 | ret = xdi_diff_outf(one, two, NULL, diffgrep_consume, |
| 69 | &ecbdata, &xpp, &xecfg); |
| 70 | if (ecbdata.hit) |
| 71 | return 1; |
| 72 | if (ret) |
| 73 | return ret; |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws, |
| 78 | unsigned int limit) |
nothing calls this directly
no test coverage detected