return ecbdata.hit;
}
-static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws)
+static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws,
+ unsigned int limit)
{
unsigned int cnt = 0;
unsigned long sz = mf->size;
sz--;
}
cnt++;
+
+ if (limit && cnt == limit)
+ return cnt;
}
} else { /* Classic exact string match */
sz -= offset + kwsm.size[0];
data += offset + kwsm.size[0];
cnt++;
+
+ if (limit && cnt == limit)
+ return cnt;
}
}
return cnt;
struct diff_options *o,
regex_t *regexp, kwset_t kws)
{
- unsigned int c1 = one ? contains(one, regexp, kws) : 0;
- unsigned int c2 = two ? contains(two, regexp, kws) : 0;
+ unsigned int c1 = one ? contains(one, regexp, kws, 0) : 0;
+ unsigned int c2 = two ? contains(two, regexp, kws, c1 + 1) : 0;
return c1 != c2;
}