summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-07 13:46:11 -0500
committerDan McGee <dan@archlinux.org>2011-06-13 19:35:22 -0500
commitd76341297a089864cf9bb509873bdcff83755f6c (patch)
tree30f154fb6e6d24357f7902ab5c2e7622c66173ae /lib/libalpm/be_package.c
parentfb3ad7f8823dd3300528b44427d40e17594b1400 (diff)
downloadpacman-d76341297a089864cf9bb509873bdcff83755f6c.tar.xz
Require handle for alpm_pkg_load()
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r--lib/libalpm/be_package.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 639179b9..9f8264b4 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -30,15 +30,13 @@
/* libalpm */
#include "alpm_list.h"
+#include "alpm.h"
#include "util.h"
#include "log.h"
#include "handle.h"
#include "package.h"
#include "deps.h" /* _alpm_splitdep */
-/* global handle variable */
-extern pmhandle_t *handle;
-
/**
* Open a package changelog for reading. Similar to fopen in functionality,
* except that the returned 'file stream' is from an archive.
@@ -225,13 +223,15 @@ static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
/**
* Load a package and create the corresponding pmpkg_t struct.
+ * @param handle the context handle
* @param pkgfile path to the package file
* @param full whether to stop the load after metadata is read or continue
* through the full archive
* @return An information filled pmpkg_t struct
*/
-pmpkg_t *_alpm_pkg_load_internal(const char *pkgfile, int full,
- const char *md5sum, const char *base64_sig, pgp_verify_t check_sig)
+pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
+ int full, const char *md5sum, const char *base64_sig,
+ pgp_verify_t check_sig)
{
int ret;
int config = 0;
@@ -384,13 +384,13 @@ error:
return NULL;
}
-int SYMEXPORT alpm_pkg_load(const char *filename, int full,
+int SYMEXPORT alpm_pkg_load(pmhandle_t *handle, const char *filename, int full,
pgp_verify_t check_sig, pmpkg_t **pkg)
{
- /* Sanity checks */
+ ASSERT(handle != NULL, return -1);
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- *pkg = _alpm_pkg_load_internal(filename, full, NULL, NULL, check_sig);
+ *pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig);
if(*pkg == NULL) {
/* pm_errno is set by pkg_load */
return -1;