pickaxe() calls pickaxe_match(); moving the definition of the former
those after the latter allows us to do without an explicit function
declaration.
Signed-off-by: Rene Scharfe l@web.de
---
diffcore-pickaxe.c | 79 ++
1 file changed, 38 insertions(+), 41 deletions(-)
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index cfc4262..827a7d7 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -12,47 +12,6 @@ typedef int (*pickaxe_fn)(mmfile_t *one, mmfile_t *two,
struct diff_options *o,
regex_t *regexp, kwset_t kws);
-static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
-regex_t *regexp, kwset_t kws, pickaxe_fn fn);
-
-static void pickaxe(struct diff_queue_struct *q, struct diff_options *o,
- regex_t *regexp, kwset_t kws, pickaxe_fn fn)
-{
- int i;
- struct diff_queue_struct outq;
-
- DIFF_QUEUE_CLEAR(outq);
-
- if (o-pickaxe_opts DIFF_PICKAXE_ALL) {
- /* Showing the whole changeset if needle exists */
- for (i = 0; i q-nr; i++) {
- struct diff_filepair *p = q-queue[i];
- if (pickaxe_match(p, o, regexp, kws, fn))
- return; /* do not munge the queue */
- }
-
- /*
-* Otherwise we will clear the whole queue by copying
-* the empty outq at the end of this function, but
-* first clear the current entries in the queue.
-*/
- for (i = 0; i q-nr; i++)
- diff_free_filepair(q-queue[i]);
- } else {
- /* Showing only the filepairs that has the needle */
- for (i = 0; i q-nr; i++) {
- struct diff_filepair *p = q-queue[i];
- if (pickaxe_match(p, o, regexp, kws, fn))
- diff_q(outq, p);
- else
- diff_free_filepair(p);
- }
- }
-
- free(q-queue);
- *q = outq;
-}
-
struct diffgrep_cb {
regex_t *regexp;
int hit;
@@ -204,6 +163,44 @@ static int pickaxe_match(struct diff_filepair *p, struct
diff_options *o,
return ret;
}
+static void pickaxe(struct diff_queue_struct *q, struct diff_options *o,
+ regex_t *regexp, kwset_t kws, pickaxe_fn fn)
+{
+ int i;
+ struct diff_queue_struct outq;
+
+ DIFF_QUEUE_CLEAR(outq);
+
+ if (o-pickaxe_opts DIFF_PICKAXE_ALL) {
+ /* Showing the whole changeset if needle exists */
+ for (i = 0; i q-nr; i++) {
+ struct diff_filepair *p = q-queue[i];
+ if (pickaxe_match(p, o, regexp, kws, fn))
+ return; /* do not munge the queue */
+ }
+
+ /*
+* Otherwise we will clear the whole queue by copying
+* the empty outq at the end of this function, but
+* first clear the current entries in the queue.
+*/
+ for (i = 0; i q-nr; i++)
+ diff_free_filepair(q-queue[i]);
+ } else {
+ /* Showing only the filepairs that has the needle */
+ for (i = 0; i q-nr; i++) {
+ struct diff_filepair *p = q-queue[i];
+ if (pickaxe_match(p, o, regexp, kws, fn))
+ diff_q(outq, p);
+ else
+ diff_free_filepair(p);
+ }
+ }
+
+ free(q-queue);
+ *q = outq;
+}
+
void diffcore_pickaxe(struct diff_options *o)
{
const char *needle = o-pickaxe;
--
1.9.1
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html