Skip to content

Commit 570fe99

Browse files
tgummerergitster
authored andcommitted
apply: only pass required data to check_header_line
Currently the 'check_header_line()' function takes 'struct apply_state' as parameter, even though it only needs the linenr from that struct. This function is in the callchain of 'parse_git_header()', which we want to make more generally useful in a subsequent commit. To make that happen we only want to pass in the required data to 'parse_git_header()', and not the whole 'struct apply_state', and thus we want functions in the callchain of 'parse_git_header()' to only take arguments they really need. Signed-off-by: Thomas Gummerer <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 85c3713 commit 570fe99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apply.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,15 +1302,15 @@ static char *git_header_name(int p_value,
13021302
}
13031303
}
13041304

1305-
static int check_header_line(struct apply_state *state, struct patch *patch)
1305+
static int check_header_line(int linenr, struct patch *patch)
13061306
{
13071307
int extensions = (patch->is_delete == 1) + (patch->is_new == 1) +
13081308
(patch->is_rename == 1) + (patch->is_copy == 1);
13091309
if (extensions > 1)
13101310
return error(_("inconsistent header lines %d and %d"),
1311-
patch->extension_linenr, state->linenr);
1311+
patch->extension_linenr, linenr);
13121312
if (extensions && !patch->extension_linenr)
1313-
patch->extension_linenr = state->linenr;
1313+
patch->extension_linenr = linenr;
13141314
return 0;
13151315
}
13161316

@@ -1380,7 +1380,7 @@ static int parse_git_header(struct apply_state *state,
13801380
res = p->fn(state, line + oplen, patch);
13811381
if (res < 0)
13821382
return -1;
1383-
if (check_header_line(state, patch))
1383+
if (check_header_line(state->linenr, patch))
13841384
return -1;
13851385
if (res > 0)
13861386
return offset;

0 commit comments

Comments
 (0)