Skip to content

Commit 102fdd2

Browse files
avargitster
authored andcommitted
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 ef90ab6 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a47fcbe commit 102fdd2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

diffcore-pickaxe.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,9 @@ static int diff_grep(mmfile_t *one, mmfile_t *two,
7070

7171
static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws)
7272
{
73-
unsigned int cnt;
74-
unsigned long sz;
75-
const char *data;
76-
77-
sz = mf->size;
78-
data = mf->ptr;
79-
cnt = 0;
73+
unsigned int cnt = 0;
74+
unsigned long sz = mf->size;
75+
const char *data = mf->ptr;
8076

8177
if (regexp) {
8278
regmatch_t regmatch;

0 commit comments

Comments
 (0)