Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
59547ce7
Commit
59547ce7
authored
Aug 14, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oid: Helper for old-school hashcmp
parent
e2164da5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
src/oid.h
+13
-10
src/sha1_lookup.c
+1
-1
No files found.
src/oid.h
View file @
59547ce7
...
...
@@ -9,17 +9,8 @@
#include "git2/oid.h"
/*
* Compare two oid structures.
*
* @param a first oid structure.
* @param b second oid structure.
* @return <0, 0, >0 if a < b, a == b, a > b.
*/
GIT_INLINE
(
int
)
git_oid__cmp
(
const
git_oid
*
a
,
const
git_oid
*
b
)
GIT_INLINE
(
int
)
git_oid__hashcmp
(
const
unsigned
char
*
sha1
,
const
unsigned
char
*
sha2
)
{
const
unsigned
char
*
sha1
=
a
->
id
;
const
unsigned
char
*
sha2
=
b
->
id
;
int
i
;
for
(
i
=
0
;
i
<
GIT_OID_RAWSZ
;
i
++
,
sha1
++
,
sha2
++
)
{
...
...
@@ -30,4 +21,16 @@ GIT_INLINE(int) git_oid__cmp(const git_oid *a, const git_oid *b)
return
0
;
}
/*
* Compare two oid structures.
*
* @param a first oid structure.
* @param b second oid structure.
* @return <0, 0, >0 if a < b, a == b, a > b.
*/
GIT_INLINE
(
int
)
git_oid__cmp
(
const
git_oid
*
a
,
const
git_oid
*
b
)
{
return
git_oid__hashcmp
(
a
->
id
,
b
->
id
);
}
#endif
src/sha1_lookup.c
View file @
59547ce7
...
...
@@ -187,7 +187,7 @@ int sha1_position(const void *table,
do
{
unsigned
mi
=
(
lo
+
hi
)
/
2
;
int
cmp
=
git_oid__
cmp
((
git_oid
*
)(
base
+
mi
*
stride
),
(
git_oid
*
)
key
);
int
cmp
=
git_oid__
hashcmp
(
base
+
mi
*
stride
,
key
);
if
(
!
cmp
)
return
mi
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment