diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-14 08:47:40 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-02-22 22:07:44 -0500 |
| commit | ef4ab2988320005cbcb3db920e6b41f10b3c60cf (patch) | |
| tree | 6609f213ad9d607e8df1f543919d3154c056c3ef /src/libgit2/oidarray.c | |
| parent | 49e180c862dc7c6d1f62a53bf8756e25b3417968 (diff) | |
| download | libgit2-ef4ab2988320005cbcb3db920e6b41f10b3c60cf.tar.gz | |
refactor: `src` is now `src/libgit2`
Diffstat (limited to 'src/libgit2/oidarray.c')
| -rw-r--r-- | src/libgit2/oidarray.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/libgit2/oidarray.c b/src/libgit2/oidarray.c new file mode 100644 index 000000000..583017c4e --- /dev/null +++ b/src/libgit2/oidarray.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ + +#include "oidarray.h" + +#include "git2/oidarray.h" +#include "array.h" + +void git_oidarray_dispose(git_oidarray *arr) +{ + git__free(arr->ids); +} + +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); + } +} + +#ifndef GIT_DEPRECATE_HARD + +void git_oidarray_free(git_oidarray *arr) +{ + git_oidarray_dispose(arr); +} + +#endif |
