Introduce struct xbps_handle and use it for xbps_init().

This structure sets up function callbacks for fetching files and
unpacking binary packages, as well as setting the debug boolean.

This way the affected functions (xbps_fetch_file() and
xbps_unpack_binary_pkg()) do not need to accept the fn cb pointers
and data as arguments.

Bump XBPS_RELVER.
This commit is contained in:
Juan RP
2011-02-21 13:38:44 +01:00
parent 0bd533f8a9
commit 22ae7aa2e8
11 changed files with 212 additions and 204 deletions

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009 Juan Romero Pardines.
* Copyright (c) 2009-2011 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -82,9 +82,7 @@ xbps_get_remote_repo_string(const char *uri)
* size and/or mtime match) and 1 if downloaded successfully.
*/
int
xbps_repository_sync_pkg_index(const char *uri,
void (*progress_cb)(void *),
struct xbps_fetch_progress_data *xfpd)
xbps_repository_sync_pkg_index(const char *uri)
{
struct url *url = NULL;
struct utsname un;
@ -163,8 +161,7 @@ xbps_repository_sync_pkg_index(const char *uri,
/*
* Download pkg-index.plist file from repository.
*/
rv = xbps_fetch_file(rpidx, fetch_outputdir, true, NULL,
progress_cb, xfpd);
rv = xbps_fetch_file(rpidx, fetch_outputdir, true, NULL);
if (rv == -1) {
(void)remove(tmp_metafile);
goto out;