summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-07-31 17:26:48 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-07-31 17:26:48 -0300
commit7e27a353e5731584d3697d34668508960c28bc1b (patch)
treeb19059601c73a0393a123b7648379d3c60a33731 /git.c
parent1b4494dc48fa3cea783ec09acfe6b20f67ce0c31 (diff)
git: Use `linked_list_to_array()` to add create the repo table, rather
than doing it manually in `init_git`
Diffstat (limited to 'git.c')
-rw-r--r--git.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/git.c b/git.c
index ea1b59a..f40f0fc 100644
--- a/git.c
+++ b/git.c
@@ -735,14 +735,9 @@ git_repository **init_git(config *cfg) {
/* Did we find any repos? */
if (repo_list != NULL) {
- int repo_count = linked_list_size(repo_list);
- log(LOG_INFO, "Found, and opened %i repositories.", repo_count);
- /* Allocate repo_count + 1 git repos, since we need a NULL entry to denote the end. */
- repos = calloc(repo_count+1, sizeof(git_repository *));
- /* Add the repos to the array. */
- for (linked_list *node = repo_list; node != NULL; /*repos[repo_count] = (git_repository *)node->data,*/ node = node->prev, --repo_count) {
- repos[repo_count] = (git_repository *)node->data;
- }
+ log(LOG_INFO, "Found, and opened %i repositories.", linked_list_size(repo_list));
+ /* Create the git repo array from our linked list. */
+ repos = (git_repository **)linked_list_to_array(repo_list);
cleanup_linked_list(repo_list);
} else {
log(LOG_ERR, "Couldn't find, and/or open any repositories.");