diff options
author | Vicent Martà <tanoku@gmail.com> | 2011-09-18 20:07:59 -0700 |
---|---|---|
committer | Vicent Martà <tanoku@gmail.com> | 2011-09-18 20:07:59 -0700 |
commit | 71a4c1f16ffc71bced673c5883d5ea621cc8d24f (patch) | |
tree | c8b035c6d1fc55f13f8c2213c9be226137fe077a /src/cache.c | |
parent | a8076074702d336b5d9f0103c8420c17bf7a6b4c (diff) | |
parent | d568d5856bcc4f283ae1dda0e27d680ee22fb067 (diff) | |
download | libgit2-71a4c1f16ffc71bced673c5883d5ea621cc8d24f.tar.gz |
Merge pull request #384 from kiryl/warnings
Add more -W flags to CFLAGS
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cache.c b/src/cache.c index cb3a4ecc0..79f3eaea2 100644 --- a/src/cache.c +++ b/src/cache.c @@ -58,12 +58,12 @@ void git_cache_free(git_cache *cache) void *git_cache_get(git_cache *cache, const git_oid *oid) { - const uint32_t *hash; + uint32_t hash; cache_node *node = NULL; void *result = NULL; - hash = (const uint32_t *)oid->id; - node = &cache->nodes[hash[0] & cache->size_mask]; + memcpy(&hash, oid->id, sizeof(hash)); + node = &cache->nodes[hash & cache->size_mask]; git_mutex_lock(&node->lock); { @@ -79,13 +79,13 @@ void *git_cache_get(git_cache *cache, const git_oid *oid) void *git_cache_try_store(git_cache *cache, void *entry) { - const uint32_t *hash; + uint32_t hash; const git_oid *oid; cache_node *node = NULL; oid = &((git_cached_obj*)entry)->oid; - hash = (const uint32_t *)oid->id; - node = &cache->nodes[hash[0] & cache->size_mask]; + memcpy(&hash, oid->id, sizeof(hash)); + node = &cache->nodes[hash & cache->size_mask]; /* increase the refcount on this object, because * the cache now owns it */ |