mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
Fix type-punning issues
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). Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e4b09dad9f
commit
b867d324ce
@ -8,7 +8,9 @@
|
||||
|
||||
static unsigned int hash_obj(const struct object *obj, unsigned int n)
|
||||
{
|
||||
unsigned int hash = *(unsigned int *)obj->sha1;
|
||||
unsigned int hash;
|
||||
|
||||
memcpy(&hash, obj->sha1, sizeof(unsigned int));
|
||||
return hash % n;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user