diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-11-10 09:10:51 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-11-10 09:10:51 -0800 |
commit | c444c16589f95ac22d8e3ffe603cd7f0613512ce (patch) | |
tree | 31d2e0c2a77344201af6f3ee5427f47218dec9bb /decorate.c | |
parent | 77f143bf3e218857ec8e5244d7e862e8e0c1a041 (diff) | |
parent | 81b50f3ce40bfdd66e5d967bf82be001039a9a98 (diff) | |
download | git-ly/mktree-using-strbuf.tar.gz |
Merge "Move 'builtin-*' into a 'builtin/' subdirectory"ly/mktree-using-strbuf
Diffstat (limited to 'decorate.c')
-rw-r--r-- | decorate.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/decorate.c b/decorate.c index 82d9e221ea..2f8a63e388 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) |