summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-10-10 15:03:35 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-10-10 15:03:35 +0000
commit6b7b9787d52ac5e7f36ba18f697bb727d43c4915 (patch)
treedeed2b10bd0519d6b7c86d5cadc825518c836217 /lib/libalpm/alpm.c
parent5d61a44759dee774e67178097c2f8acffe12836f (diff)
downloadpacman-6b7b9787d52ac5e7f36ba18f697bb727d43c4915.tar.xz
- more sanity checks
- alpm_pkg_free can now return an error code
Diffstat (limited to 'lib/libalpm/alpm.c')
-rw-r--r--lib/libalpm/alpm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index ebb01221..427c536b 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -394,8 +394,7 @@ void *alpm_pkg_getinfo(pmpkg_t *pkg, unsigned char parm)
}
break;
/* Depends entry */
- /* ORE
- not needed: the cache is loaded with DEPENDS by default
+ /* not needed: the cache is loaded with DEPENDS by default
case PM_PKG_DEPENDS:
case PM_PKG_REQUIREDBY:
case PM_PKG_CONFLICTS:
@@ -473,9 +472,14 @@ int alpm_pkg_load(char *filename, pmpkg_t **pkg)
return(0);
}
-void alpm_pkg_free(pmpkg_t *pkg)
+int alpm_pkg_free(pmpkg_t *pkg)
{
+ ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
+ ASSERT(pkg->origin != PKG_FROM_CACHE, RET_ERR(PM_ERR_XXX, -1));
+
pkg_free(pkg);
+
+ return(0);
}
int alpm_pkg_vercmp(const char *ver1, const char *ver2)
@@ -542,6 +546,7 @@ void *alpm_trans_getinfo(unsigned char parm)
/* Sanity checks */
ASSERT(handle != NULL, return(NULL));
+ ASSERT(handle->trans != NULL, return(NULL));
trans = handle->trans;