X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=decorate.c;h=2f8a63e38881587fe29fcb72a5272ef54b9efa6e;hb=bd193f46b70fd3f8a55e2a8dcbb1fb2b4eec13d6;hp=82d9e221eabab53acc418d0db6327e480836a5ed;hpb=77f143bf3e218857ec8e5244d7e862e8e0c1a041;p=git.git diff --git a/decorate.c b/decorate.c index 82d9e221e..2f8a63e38 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; } @@ -16,7 +18,7 @@ static void *insert_decoration(struct decoration *n, const struct object *base, { int size = n->size; struct object_decoration *hash = n->hash; - int j = hash_obj(base, size); + unsigned int j = hash_obj(base, size); while (hash[j].base) { if (hash[j].base == base) { @@ -68,7 +70,7 @@ void *add_decoration(struct decoration *n, const struct object *obj, /* Lookup a decoration pointer */ void *lookup_decoration(struct decoration *n, const struct object *obj) { - int j; + unsigned int j; /* nothing to lookup */ if (!n->size)