git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] refs.h: make all flags arguments unsigned

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 1, 2022, 18:41 UTC
Message-ID
<xmqqh79ie8eg.fsf@gitster.g>
In-Reply-To
<CAFQ2z_PtNsrSXdCG_5vr99Fz63GDMpC6j7rzLqOn+cZufi+xfQ@mail.gmail.com>
Han-Wen Nienhuys <hanwen@google.com> writes:
Show 28 quoted lines
> On Tue, Feb 1, 2022 at 3:02 AM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> "Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
>>
>> > From: Han-Wen Nienhuys <hanwen@google.com>
>> >
>> > As discussed in
>> > https://lore.kernel.org/git/xmqqbkzrkevo.fsf@gitster.g/ , we don't
>> > want to treat the sign bit specially, so make all flags in refs.h
>> > unsigned.
>>
>> It may be true that we do not want to, but are we sure there is no
>> code that already uses some cleverness to make the topmost bit
>> special by e.g. doing ugly things like "if (flags < 0)" ;-)?
>
> In refs.h, we don't have any bitmasks that accept 32 different bit
> values, so it's hard to see how we would stumble into a case like
> that.
>
>> I haven't had energy to vet the entire codebase for all flag words
>> and that is why I've never produced a patch like this one myself.
>>
>> Thanks for carefully vetting after creating this (presumably
>> mechanically prepared) patch---producing is the easy part, but
>> making sure it does not break unexpectedly is much harder.
>
> I went over the changes once more, uniformizing the naming. I didn't
> see any shenanigans.
Thanks again.
Previous: Han-Wen NienhuysNext: Han-Wen Nienhuys via GitGitGadget
Message 4 of 17 in “refs.h: make all flags arguments unsigned”
  1. refs.h: make all flags arguments unsignedHan-Wen Nienhuys via GitGitGadget, Jan 31, 2022
  2. Junio C HamanoFeb 1, 2022
  3. Han-Wen NienhuysFeb 1, 2022
  4. Junio C HamanoFeb 1, 2022
  5. refs.h: make all flags arguments unsignedHan-Wen Nienhuys via GitGitGadget, Feb 1, 2022
  6. Ævar Arnfjörð BjarmasonFeb 1, 2022
  7. Junio C HamanoFeb 1, 2022
  8. Han-Wen NienhuysFeb 3, 2022
  9. Ævar Arnfjörð BjarmasonFeb 3, 2022
  10. Han-Wen NienhuysFeb 3, 2022
  11. Ævar Arnfjörð BjarmasonFeb 3, 2022
  12. Junio C HamanoFeb 3, 2022
  13. Han-Wen NienhuysFeb 3, 2022
  14. Junio C HamanoFeb 3, 2022
  15. 0/2 refs.h: make all flags arguments unsignedHan-Wen Nienhuys via GitGitGadget, Feb 3, 2022
  16. 1/2 refs.h: make all flags arguments unsignedHan-Wen Nienhuys via GitGitGadget, Feb 3, 2022
  17. 2/2 Uniformize flag argument naming to `flags` or `unused_flags`Han-Wen Nienhuys via GitGitGadget, Feb 3, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.