]> git.ipfire.org Git - thirdparty/git.git/commit
streaming.c: remove enum/function/vtbl indirection
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 5 May 2021 12:33:29 +0000 (14:33 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 May 2021 03:56:04 +0000 (12:56 +0900)
commit0d9af06e36d2e88e5e370c23e876a835fcf8b7ce
tree40c3e7b9cb542d3ef1c35d38142c92f6032ffa94
parentb65528360f1153c2f912d272cce18abe56e25562
streaming.c: remove enum/function/vtbl indirection

Remove the indirection of discovering a function pointer to use via an
enum and virtual table. This refactors code added in
46bf043807c (streaming: a new API to read from the object store,
2011-05-11).

We can instead simply return an "open_istream_fn" for use from the
"istream_source()" selector function directly. This allows us to get
rid of the "incore", "loose" and "pack_non_delta" enum
variables. We'll return the functions instead.

The "stream_error" variable in that enum can likewise go in favor of
returning NULL, which is what the open_istream() was doing when it got
that value anyway.

We can thus remove the entire enum, and the "open_istream_tbl" virtual
table that (indirectly) referenced it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
streaming.c