| 1 |
|
| /* |
| 2 |
|
| * Copyright (C) the libgit2 contributors. All rights reserved. |
| 3 |
|
| * |
| 4 |
|
| * This file is part of libgit2, distributed under the GNU GPL v2 with |
| 5 |
|
| * a Linking Exception. For full terms see the included COPYING file. |
| 6 |
|
| */ |
| 7 |
|
| |
| 8 |
|
| #include "oidarray.h" |
| 9 |
|
| |
| 10 |
|
| #include "git2/oidarray.h" |
| 11 |
|
| #include "array.h" |
| 12 |
|
| |
| 13 |
6 |
| void git_oidarray_dispose(git_oidarray *arr) |
| 14 |
|
| { |
| 15 |
6 |
| git__free(arr->ids); |
| 16 |
6 |
| } |
| 17 |
|
| |
| 18 |
6 |
| void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array) |
| 19 |
|
| { |
| 20 |
6 |
| arr->count = array->size; |
| 21 |
6 |
| arr->ids = array->ptr; |
| 22 |
6 |
| } |
| 23 |
|
| |
| 24 |
6 |
| void git_oidarray__reverse(git_oidarray *arr) |
| 25 |
|
| { |
| 26 |
|
| size_t i; |
| 27 |
|
| git_oid tmp; |
| 28 |
|
| |
| 29 |
6 |
▶ | for (i = 0; i < arr->count / 2; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < arr->count / 2; i++) { |
0 |
6 |
6 |
|
| 30 |
0 |
| git_oid_cpy(&tmp, &arr->ids[i]); |
| 31 |
0 |
| git_oid_cpy(&arr->ids[i], &arr->ids[(arr->count-1)-i]); |
| 32 |
0 |
| git_oid_cpy(&arr->ids[(arr->count-1)-i], &tmp); |
| 33 |
|
| } |
| 34 |
6 |
| } |
| 35 |
|
| |
| 36 |
|
| #ifndef GIT_DEPRECATE_HARD |
| 37 |
|
| |
| 38 |
0 |
| void git_oidarray_free(git_oidarray *arr) |
| 39 |
|
| { |
| 40 |
0 |
| git_oidarray_dispose(arr); |
| 41 |
0 |
| } |
| 42 |
|
| |
| 43 |
|
| #endif |