pickaxe: simplify kwset loop in contains()
Inlining the variable "found" actually makes the code shorter and easier to read. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
542b2aa2c9
commit
e4aab50475
@ -94,13 +94,10 @@ static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws)
|
|||||||
while (sz) {
|
while (sz) {
|
||||||
struct kwsmatch kwsm;
|
struct kwsmatch kwsm;
|
||||||
size_t offset = kwsexec(kws, data, sz, &kwsm);
|
size_t offset = kwsexec(kws, data, sz, &kwsm);
|
||||||
const char *found;
|
|
||||||
if (offset == -1)
|
if (offset == -1)
|
||||||
break;
|
break;
|
||||||
else
|
sz -= offset + kwsm.size[0];
|
||||||
found = data + offset;
|
data += offset + kwsm.size[0];
|
||||||
sz -= found - data + kwsm.size[0];
|
|
||||||
data = found + kwsm.size[0];
|
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user