Re: [PATCH 7/8] builtin/repack.c: drop `DELETE_PACK` macro
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 6, 2023, 17:05 UTC
- Message-ID
- <xmqqh6o7nsf2.fsf@gitster.g>
- In-Reply-To
- <559b487e2ab056c79367a673188764e4cdce3c96.1693946195.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
> Signed-off-by: Taylor Blau <me@ttaylorr.com> > --- > builtin/repack.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-)
The reason being...?
Show 6 quoted lines
> @@ -130,7 +132,7 @@ static void mark_packs_for_deletion_1(struct string_list *names, > * (if `-d` was given). > */ > if (!string_list_has_string(names, sha1)) > - item->util = (void*)(uintptr_t)((size_t)item->util | DELETE_PACK); > + item->util = (void*)1;
Presumably the literal "1" is promoted to an appropriate type (uintptr_t) here?
We originally planned to use the .util member to store a bitset
to represent various attributes for each pack, and defined
DELETE_PACK as one of the possible bits, but over the N years of
its existence, we never found the need for the second bit.or something?
It is not a bad idea to demote .util from a set of bits to just a "is it NULL?" boolean, but updating the above to something like
#define DELETE_PACK ((void*)(uintptr_t)1) item->util = DELETE_PACK;
may still reap the same simplification benefit without introducing the "what is that _one_ about? can it be _two_ without changing the meaning or what?" puzzlement.
Other than that, everything else in the series looked quite straight-forward and sensible.
Thanks.