summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-07-29 22:30:01 -0700
committerRussell Belfer <rb@github.com>2012-07-29 22:30:01 -0700
commit50364dd892ae6726ff34e1842711e29d0f20c51d (patch)
tree6d8aceb0bb50223d2f4791e11d6cab171923e0ec /src
parent6810ba089a543a2407b1c8824dffa9b4e1d63975 (diff)
parentf6b26e770ffae621408532c5b2c1aae4fa1c9e49 (diff)
downloadlibgit2-50364dd892ae6726ff34e1842711e29d0f20c51d.tar.gz
Merge pull request #847 from schu/inline-oid-cmp
git_oid_cmp: inline memcmp by hand to optimize
Diffstat (limited to 'src')
-rw-r--r--src/oid.c5
-rw-r--r--src/oidmap.h7
2 files changed, 1 insertions, 11 deletions
diff --git a/src/oid.c b/src/oid.c
index 87756010b..556a2cf85 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -161,11 +161,6 @@ void git_oid_cpy(git_oid *out, const git_oid *src)
memcpy(out->id, src->id, sizeof(out->id));
}
-int git_oid_cmp(const git_oid *a, const git_oid *b)
-{
- return memcmp(a->id, b->id, sizeof(a->id));
-}
-
int git_oid_ncmp(const git_oid *oid_a, const git_oid *oid_b, unsigned int len)
{
const unsigned char *a = oid_a->id;
diff --git a/src/oidmap.h b/src/oidmap.h
index 5a0bab6ec..1791adb16 100644
--- a/src/oidmap.h
+++ b/src/oidmap.h
@@ -28,13 +28,8 @@ GIT_INLINE(khint_t) hash_git_oid(const git_oid *oid)
return h;
}
-GIT_INLINE(int) hash_git_oid_equal(const git_oid *a, const git_oid *b)
-{
- return (memcmp(a->id, b->id, sizeof(a->id)) == 0);
-}
-
#define GIT__USE_OIDMAP \
- __KHASH_IMPL(oid, static kh_inline, const git_oid *, void *, 1, hash_git_oid, hash_git_oid_equal)
+ __KHASH_IMPL(oid, static kh_inline, const git_oid *, void *, 1, hash_git_oid, git_oid_equal)
#define git_oidmap_alloc() kh_init(oid)
#define git_oidmap_free(h) kh_destroy(oid,h), h = NULL