]> git.ipfire.org Git - thirdparty/git.git/commit - apply.c
apply: only pass required data to gitdiff_* functions
authorThomas Gummerer <t.gummerer@gmail.com>
Thu, 11 Jul 2019 16:08:43 +0000 (17:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jul 2019 21:29:27 +0000 (14:29 -0700)
commit80e184123202761a4be32be12be12f7ff469fe5b
tree1609c52181587d85dee44e883b442898414695f1
parent877a833b5126f9a06dad07db169b770f898cc7b9
apply: only pass required data to gitdiff_* functions

Currently the 'gitdiff_*()' functions take 'struct apply_state' as
parameter, even though they only needs the root, linenr and p_value
from that struct.

These functions are 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.

As these functions are called in a loop using their function pointers,
each function needs to be passed all the parameters even if only one
of the functions actually needs it.  We therefore pass this data along
in a struct to avoid adding too many unused parameters to each
function and making the code very verbose in the process.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c