On Tue, May 12, 2009 at 2:57 AM, Junio C Hamano [off-list ref] wrote:
Dan McGee [off-list ref] writes:
quoted
In these two places we are casting part of our unsigned char sha1 array into
an unsigned int, which violates GCCs strict-aliasing rules (and probably
other compilers).
Yay.
It might make more sense to have one canonical
unsigned int hash_obj(const struct object *obj, unsigned int n)
here, export it to object.h, and remove the one in decorate.c.
Or am I missing something?
(argh: sorry Junio for sending the last reply to just you)
So due to me taking so long to resubmit, I see you committed a
stripped-down version of my patch. I had a patch just like this (minus
one newline diff), but it was in a series of 4 I will submit in just a
second.
The three remaining patches implement the above suggestion of having
one canonical "hash" function. However, the name changes to hash_char
and takes a unsigned char pointer rather than a struct object pointer
so we can use the same function for both insertion into the hashes as
well as lookup.
Looking forward to any feedback.
-Dan