diff options
-rw-r--r-- | git.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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."); |