Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decorate.c4
-rw-r--r--object.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/decorate.c b/decorate.c
index 82d9e221ea..e6fd8a7441 100644
--- a/decorate.c
+++ b/decorate.c
@@ -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;
}
diff --git a/object.c b/object.c
index 7e6a92c88e..e1feef9c33 100644
--- a/object.c
+++ b/object.c
@@ -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;
}