summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b5f07f)
raw | patch | inline | side by side (parent: 2b5f07f)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Thu, 6 Oct 2011 16:23:11 +0000 (18:23 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 7 Oct 2011 22:46:13 +0000 (15:46 -0700) |
With -S... --pickaxe-all, free the regex or the kws before returning
even if we found a match. Also get rid of the variable has_changes,
as we can simply break out of the loop.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
even if we found a match. Also get rid of the variable has_changes,
as we can simply break out of the loop.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-pickaxe.c | patch | blob | history |
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 96f7ea67da3895da3efa471d0bf85dee92036e92..c367d8d17afb966830aa5e88451fcef4ea103da7 100644 (file)
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
if (opts & DIFF_PICKAXE_ALL) {
/* Showing the whole changeset if needle exists */
- for (i = has_changes = 0; !has_changes && i < q->nr; i++) {
+ for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
if (!DIFF_FILE_VALID(p->one)) {
if (!DIFF_FILE_VALID(p->two))
contains(p->one, needle, len, regexp, kws) !=
contains(p->two, needle, len, regexp, kws))
has_changes++;
+ if (has_changes)
+ goto out; /* do not munge the queue */
}
- if (has_changes)
- return; /* not munge the queue */
/* otherwise we will clear the whole queue
* by copying the empty outq at the end of this
diff_free_filepair(p);
}
+ free(q->queue);
+ *q = outq;
+
+ out:
if (opts & DIFF_PICKAXE_REGEX)
regfree(®ex);
else
kwsfree(kws);
-
- free(q->queue);
- *q = outq;
return;
}