mbox series

[0/5] streaming.c: refactor for smaller + easier to understand code

Message ID cover-0.5-00000000000-20210505T122816Z-avarab@gmail.com (mailing list archive)
Headers show
Series streaming.c: refactor for smaller + easier to understand code | expand

Message

Ævar Arnfjörð Bjarmason May 5, 2021, 12:33 p.m. UTC
This is a prep series for my yet-to-be-sent re-roll of [1],
aka. ab/fsck-unexpected-type.

Jeff King had a comment in [2] saying it was odd to have an "oi2"
variable, that was because there was on an "oi" name already defined
via the new-gone open_method_decl(loose) macro. As we'll see we could
do without the initial "oi" and a few other types of indirection in
this interface.

Junio: Could you eject ab/fsck-unexpected-type while this is being
considered/cooked? I didn't really see how to address Jeff's feedback
about that variable name in a way that wouldn't just make something
like this refactoring part of an even bigger series. I think ejecting
the functional changes & trying to get this in first is the least
worst approach at this point. Eventually I'll submit a re-roll of
ab/fsck-unexpected-type either based on this, or master (if it's
landed already).

1. https://lore.kernel.org/git/cover-0.6-00000000000-20210413T093734Z-avarab@gmail.com/#t
2. https://lore.kernel.org/git/YILZHiuUyj0mt958@coredump.intra.peff.net/

Ævar Arnfjörð Bjarmason (5):
  streaming.c: avoid forward declarations
  streaming.c: remove enum/function/vtbl indirection
  streaming.c: remove {open,close,read}_method_decl() macros
  streaming.c: stop passing around "object_info *" to open()
  streaming.c: move {open,close,read} from vtable to "struct
    git_istream"

 streaming.c | 268 ++++++++++++++++++++++------------------------------
 1 file changed, 115 insertions(+), 153 deletions(-)

Comments

Jeff King May 5, 2021, 1:57 p.m. UTC | #1
On Wed, May 05, 2021 at 02:33:27PM +0200, Ævar Arnfjörð Bjarmason wrote:

> This is a prep series for my yet-to-be-sent re-roll of [1],
> aka. ab/fsck-unexpected-type.
> 
> Jeff King had a comment in [2] saying it was odd to have an "oi2"
> variable, that was because there was on an "oi" name already defined
> via the new-gone open_method_decl(loose) macro. As we'll see we could
> do without the initial "oi" and a few other types of indirection in
> this interface.
> 
> Junio: Could you eject ab/fsck-unexpected-type while this is being
> considered/cooked? I didn't really see how to address Jeff's feedback
> about that variable name in a way that wouldn't just make something
> like this refactoring part of an even bigger series. I think ejecting
> the functional changes & trying to get this in first is the least
> worst approach at this point. Eventually I'll submit a re-roll of
> ab/fsck-unexpected-type either based on this, or master (if it's
> landed already).

I think my feedback was really just: if that patch didn't refactor
parse_loose_header() to get rid of the "simple" and extended versions,
then you wouldn't have to touch streaming.c at all. It could just
continue to use the simple version.

That said, I don't mind the cleanups here, especially getting rid of the
macros.

-Peff