]> git.ipfire.org Git - thirdparty/git.git/commit - revision.h
revisions API: extend the nascent REV_INFO_INIT macro
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 8 Nov 2022 14:02:57 +0000 (15:02 +0100)
committerTaylor Blau <me@ttaylorr.com>
Tue, 8 Nov 2022 21:34:01 +0000 (16:34 -0500)
commit916ebb327c813b44a054b6487cc5e5e224723f05
tree44ea4200874c900e453bfa48198542a42b7c09a9
parent3b08839926fcc7cc48cf4c759737c1a71af430c1
revisions API: extend the nascent REV_INFO_INIT macro

Have the REV_INFO_INIT macro added in [1] declare more members of
"struct rev_info" that we can initialize statically, and have
repo_init_revisions() do so with the memcpy(..., &blank) idiom
introduced in [2].

As the comment for the "REV_INFO_INIT" macro notes this still isn't
sufficient to initialize a "struct rev_info" for use yet. But we are
getting closer to that eventual goal.

Even though we can't fully initialize a "struct rev_info" with
REV_INFO_INIT it's useful for readability to clearly separate those
things that we can statically initialize, and those that we can't.

This change could replace the:

list_objects_filter_init(&revs->filter);

In the repo_init_revisions() with this line, at the end of the
REV_INFO_INIT deceleration in revisions.h:

.filter = LIST_OBJECTS_FILTER_INIT, \

But doing so would produce a minor conflict with an outstanding
topic[3]. Let's skip that for now. I have follow-ups to initialize
more of this statically, e.g. changes to get rid of grep_init(). We
can initialize more members with the macro in a future series.

1. f196c1e908d (revisions API users: use release_revisions() needing
   REV_INFO_INIT, 2022-04-13)
2. 5726a6b4012 (*.c *_init(): define in terms of corresponding *_INIT
   macro, 2021-07-01)
3. https://lore.kernel.org/git/265b292ed5c2de19b7118dfe046d3d9d932e2e89.1667901510.git.ps@pks.im/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
revision.c
revision.h