mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-21 22:32:33 +00:00
Fix a "dereference of type-punned pointer" compiler warning
gcc (4.4.0) issues the following warning: src/revobject.c:33: warning: dereferencing type-punned pointer \ will break strict-aliasing rules We suppress the warning by copying the first 4 bytes from the oid structure into an 'unsigned int' using memcpy(). This will also fix any potential alignment issues on certain platforms. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
This commit is contained in:
parent
6e0fa05b58
commit
c1b62b2ede
@ -30,7 +30,9 @@ static const double max_load_factor = 0.65;
|
|||||||
|
|
||||||
static unsigned int git_revpool_table__hash(const git_oid *id)
|
static unsigned int git_revpool_table__hash(const git_oid *id)
|
||||||
{
|
{
|
||||||
return *((unsigned int *)id->id);
|
unsigned int r;
|
||||||
|
memcpy(&r, id->id, sizeof(r));
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_revpool_table *git_revpool_table_create(unsigned int min_size)
|
git_revpool_table *git_revpool_table_create(unsigned int min_size)
|
||||||
|
Loading…
Reference in New Issue
Block a user