Commit e4aab504 authored by René Scharfe's avatar René Scharfe Committed by Junio C Hamano

pickaxe: simplify kwset loop in contains()

Inlining the variable "found" actually makes the code shorter and
easier to read.
Signed-off-by: default avatarRene Scharfe <l.s.r@web.de>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 542b2aa2
......@@ -94,13 +94,10 @@ static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws)
while (sz) {
struct kwsmatch kwsm;
size_t offset = kwsexec(kws, data, sz, &kwsm);
const char *found;
if (offset == -1)
break;
else
found = data + offset;
sz -= found - data + kwsm.size[0];
data = found + kwsm.size[0];
sz -= offset + kwsm.size[0];
data += offset + kwsm.size[0];
cnt++;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment