From 102fdd2e07f72919060224b3eb3560524d6cf1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 12 Apr 2021 19:15:17 +0200 Subject: pickaxe/style: consolidate declarations and assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- diffcore-pickaxe.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'diffcore-pickaxe.c') 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; -- cgit v1.2.3