summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-08-01 10:07:05 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-08-01 10:07:05 -0400
commit61518be4c21d6d437e6f59c0599f6df083053ff8 (patch)
treea87b9e4378146a4040bca36d208cc6debc927e30 /git.c
parent03860c7b8e6fa95133ba44b49ac0461501a7b728 (diff)
Added `free_files()`, and `free_file()`.
Diffstat (limited to 'git.c')
-rw-r--r--git.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/git.c b/git.c
index 2ba16a1..19a7690 100644
--- a/git.c
+++ b/git.c
@@ -64,6 +64,23 @@ void cleanup_git(git_repository **repos) {
git_libgit2_shutdown();
}
+void free_file(file *file) {
+ if (file->name != NULL) {
+ free(file->name);
+ }
+ if (file->buf != NULL) {
+ free(file->buf);
+ }
+}
+
+void free_files(file **files) {
+ for (int i = 0; files[i] != NULL; i++) {
+ free_file(files[i]);
+ files[i] = NULL;
+ }
+ free(files);
+}
+
pull_request *get_pull_request(int id, const char *root) {
}