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
ed51feb7
Commit
ed51feb7
authored
Jan 21, 2018
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oidarray: introduce git_oidarray__reverse
Provide a simple function to reverse an oidarray.
parent
7bd89502
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
src/oidarray.c
+12
-0
src/oidarray.h
+1
-0
No files found.
src/oidarray.c
View file @
ed51feb7
...
...
@@ -20,3 +20,15 @@ void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array)
arr
->
count
=
array
->
size
;
arr
->
ids
=
array
->
ptr
;
}
void
git_oidarray__reverse
(
git_oidarray
*
arr
)
{
size_t
i
;
git_oid
tmp
;
for
(
i
=
0
;
i
<
arr
->
count
/
2
;
i
++
)
{
git_oid_cpy
(
&
tmp
,
&
arr
->
ids
[
i
]);
git_oid_cpy
(
&
arr
->
ids
[
i
],
&
arr
->
ids
[(
arr
->
count
-
1
)
-
i
]);
git_oid_cpy
(
&
arr
->
ids
[(
arr
->
count
-
1
)
-
i
],
&
tmp
);
}
}
src/oidarray.h
View file @
ed51feb7
...
...
@@ -14,6 +14,7 @@
typedef
git_array_t
(
git_oid
)
git_array_oid_t
;
extern
void
git_oidarray__reverse
(
git_oidarray
*
arr
);
extern
void
git_oidarray__from_array
(
git_oidarray
*
arr
,
git_array_oid_t
*
array
);
#endif
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