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:
authorKarsten Blees <karsten.blees@gmail.com>2014-07-03 02:20:20 +0400
committerJunio C Hamano <gitster@pobox.com>2014-07-08 00:56:24 +0400
commit039dc71a7cb824300e242f8abc0fcb19dac93641 (patch)
tree9c38bb8655e0314cfe122b7355922c2413533825 /decorate.c
parent6f92e5ff3cdc813de8ef5327fd4bad492fb7d6c9 (diff)
hashmap: factor out getting a hash code from a SHA1
Copying the first bytes of a SHA1 is duplicated in six places, however, the implications (the actual value would depend on the endianness of the platform) is documented only once. Add a properly documented API for this. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'decorate.c')
-rw-r--r--decorate.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/decorate.c b/decorate.c
index 7cb5d29a89..b2aac90c26 100644
--- a/decorate.c
+++ b/decorate.c
@@ -8,10 +8,7 @@
static unsigned int hash_obj(const struct object *obj, unsigned int n)
{
- unsigned int hash;
-
- memcpy(&hash, obj->sha1, sizeof(unsigned int));
- return hash % n;
+ return sha1hash(obj->sha1) % n;
}
static void *insert_decoration(struct decoration *n, const struct object *base, void *decoration)