From: Jonathan Nieder Date: Fri, 18 Apr 2014 22:40:49 GMT Subject: Re: Refactoring hardcoded SHA-1 constants Message-ID: <20140418224049.GA15516@google.com> In-Reply-To: <20140418221841.GC57656@vauxhall.crustytoothpaste.net> Hi, brian m. carlson wrote: > I'd like to introduce a set of preprocessor constants that we'd use > instead of hard-coded 20s and 40s everywhere. Lukewarm on that. It's hard to do consistently and unless they're named well it can be harder to know what something like BINARY_OBJECT_NAME_LENGTH means than plain '20' when first reading. [...] > I would also like to consider, as a third step, turning all of the > unsigned char[20] uses into a struct containing unsigned char[20] as its > only member, like libgit2 does. That would be very welcome! It's a nice way to steer people toward hashcmp using the type system, and it makes it possible to use a union to enforce alignment later if measurements show benefit. Thanks, Jonathan