From a65ad4efc1102449a087b464d3b8d4670a614b99 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 14 Aug 2007 10:14:35 -0400 Subject: package.h: implement origin_data union in pmpkg_t struct We were using a void *data element in pmpkg_t before, which is unsafe by its nature of being untyped. Reimplement data as origin_data being a union that can hold either a path to a package file or a pointer to a cache database, and make the other necesary updates in the code to reflect this. See package.h for details. Signed-off-by: Dan McGee --- lib/libalpm/add.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index e5323042..e9a4d7b7 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -738,7 +738,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, /* pre_upgrade scriptlet */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { - _alpm_runscriptlet(handle->root, newpkg->data, "pre_upgrade", newpkg->version, oldpkg->version, trans); + _alpm_runscriptlet(handle->root, newpkg->origin_data.file, + "pre_upgrade", newpkg->version, oldpkg->version, trans); } } else { is_upgrade = 0; @@ -749,7 +750,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, /* pre_install scriptlet */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { - _alpm_runscriptlet(handle->root, newpkg->data, "pre_install", newpkg->version, NULL, trans); + _alpm_runscriptlet(handle->root, newpkg->origin_data.file, + "pre_install", newpkg->version, NULL, trans); } } @@ -771,7 +773,8 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, archive_read_support_compression_all(archive); archive_read_support_format_all(archive); - if(archive_read_open_file(archive, newpkg->data, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { + if(archive_read_open_filename(archive, newpkg->origin_data.file, + ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { RET_ERR(PM_ERR_PKG_OPEN, -1); } -- cgit v1.2.3-24-g4f1b