diff options
author | Dan McGee <dpmcgee@gmail.com> | 2009-05-11 20:17:38 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-16 22:41:18 -0700 |
commit | b867d324ceb7e5c4f14a04c6b55d69498812d24b (patch) | |
tree | 4995fea8f2d925feaeb0183ac2e87c6fa86a5144 /object.c | |
parent | e4b09dad9f65395fd4bb8ab165012a3a6698a75b (diff) | |
download | git-b867d324ceb7e5c4f14a04c6b55d69498812d24b.tar.gz |
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>
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -45,7 +45,8 @@ int type_from_string(const char *str) static unsigned int hash_obj(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; } |