Re: [PATCH] refs.h: make all flags arguments unsigned
From: Han-Wen Nienhuys <hidden>
Date: 2022-02-01 11:47:26
On Tue, Feb 1, 2022 at 3:02 AM Junio C Hamano [off-list ref] wrote:
"Han-Wen Nienhuys via GitGitGadget" [off-list ref] writes:quoted
From: Han-Wen Nienhuys <redacted> As discussed in https://lore.kernel.org/git/xmqqbkzrkevo.fsf@gitster.g/ (local) , 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. -- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado