summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 05ac978)
raw | patch | inline | side by side (parent: 05ac978)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Thu, 6 Oct 2011 16:14:55 +0000 (18:14 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 7 Oct 2011 22:46:13 +0000 (15:46 -0700) |
With -G... --pickaxe-all, free the regex 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>
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 0835a3be8d7b54e6654def5e7793cc0a38eed647..96f7ea67da3895da3efa471d0bf85dee92036e92 100644 (file)
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
static void diffcore_pickaxe_grep(struct diff_options *o)
{
struct diff_queue_struct *q = &diff_queued_diff;
- int i, has_changes, err;
+ int i, err;
regex_t regex;
struct diff_queue_struct outq;
outq.queue = NULL;
if (o->pickaxe_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_grep(p, ®ex, o))
- has_changes++;
+ goto out; /* do not munge the queue */
}
- if (has_changes)
- return; /* do not munge the queue */
/*
* Otherwise we will clear the whole queue by copying
}
}
- regfree(®ex);
-
free(q->queue);
*q = outq;
+
+ out:
+ regfree(®ex);
return;
}