Skip to content

Commit

Permalink
pickaxe: simplify kwset loop in contains()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Mar 24, 2014
1 parent 542b2aa commit e4aab50
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions diffcore-pickaxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand Down

0 comments on commit e4aab50

Please sign in to comment.