Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-04-12 20:15:17 +0300
committerJunio C Hamano <gitster@pobox.com>2021-05-11 06:47:31 +0300
commit102fdd2e07f72919060224b3eb3560524d6cf1f9 (patch)
tree6afbd94b4d65eb98a1f778aada0f6a4dac096538 /diffcore-pickaxe.c
parenta47fcbe6e412df295f1f5ffb8eca6dbe86d2b7bb (diff)
pickaxe/style: consolidate declarations and assignments
Refactor contains() to do its assignments at the same time that it does its declarations. This code could have been refactored in ef90ab66e8e (pickaxe: use textconv for -S counting, 2012-10-28) when a function call between the declarations and assignments was removed. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-pickaxe.c')
-rw-r--r--diffcore-pickaxe.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index a9c6d60df2..a278b9b71d 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -70,13 +70,9 @@ static int diff_grep(mmfile_t *one, mmfile_t *two,
static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws)
{
- unsigned int cnt;
- unsigned long sz;
- const char *data;
-
- sz = mf->size;
- data = mf->ptr;
- cnt = 0;
+ unsigned int cnt = 0;
+ unsigned long sz = mf->size;
+ const char *data = mf->ptr;
if (regexp) {
regmatch_t regmatch;