summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-03-22 18:16:00 +0100
committerJunio C Hamano <gitster@pobox.com>2014-03-24 15:13:17 -0700
commite4aab50475c1d384e016c6ac6548635f1ddcd3fe (patch)
treef412694de141b00a08e88562f5bb4e845d7ae88b
parent542b2aa2c9afba71febb248edb3083ff9cacf065 (diff)
downloadgit-e4aab50475c1d384e016c6ac6548635f1ddcd3fe.tar.gz
pickaxe: simplify kwset loop in contains()rs/pickaxe-i
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>
-rw-r--r--diffcore-pickaxe.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 70753d058a..185f86b284 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -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++;
}
}