repo: introduce xbps_repo_release(), misc changes.

- xbps_repo_release(): new function to release all resources
  associated with a repository object.

- xbps_repo_close(): this now just closes the file descriptor
  associated with the archive and associated resources.

- repo_open_local: after getting the repository dictionaries,
  use xbps_repo_close() to release archive resources.

Bump XBPS_API_VERSION.
This commit is contained in:
Juan RP
2020-04-14 20:08:06 +02:00
parent b9fb5e1cc8
commit 70efe5c63a
3 changed files with 44 additions and 16 deletions

View File

@@ -120,16 +120,18 @@ xbps_rpool_get_repo(const char *url)
}
void
xbps_rpool_release(struct xbps_handle *xhp UNUSED)
xbps_rpool_release(struct xbps_handle *xhp)
{
struct xbps_repo *repo;
while ((repo = SIMPLEQ_FIRST(&rpool_queue))) {
SIMPLEQ_REMOVE(&rpool_queue, repo, xbps_repo, entries);
xbps_repo_close(repo);
xbps_repo_release(repo);
}
if (xhp->repositories)
if (xhp && xhp->repositories) {
xbps_object_release(xhp->repositories);
xhp->repositories = NULL;
}
}
int