Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=72818083e09e97ff36b385049fa6e4cd52327b12
commit 72818083e09e97ff36b385049fa6e4cd52327b12 Author: Michel Hermier <[email protected]> Date: Sat Nov 9 08:20:20 2013 +0100 libpacman: s/_pacman_needbackup/_pacman_pkg_fileneedbackup/ and use package as argument. diff --git a/lib/libpacman/add.c b/lib/libpacman/add.c index 1f1cd13..7ba73f2 100644 --- a/lib/libpacman/add.c +++ b/lib/libpacman/add.c @@ -440,8 +440,8 @@ int _pacman_add_commit(pmtrans_t *trans, pmlist_t **data) nb = _pacman_list_is_strin(pathname, pkg_new->backup); } else { /* op == PM_TRANS_TYPE_UPGRADE */ - md5_orig = _pacman_needbackup(pathname, oldpkg->backup); - sha1_orig = _pacman_needbackup(pathname, oldpkg->backup); + md5_orig = _pacman_pkg_fileneedbackup(oldpkg, pathname); + sha1_orig = _pacman_pkg_fileneedbackup(oldpkg, pathname); if(md5_orig || sha1_orig) { nb = 1; } diff --git a/lib/libpacman/package.c b/lib/libpacman/package.c index 8913155..d8329c0 100644 --- a/lib/libpacman/package.c +++ b/lib/libpacman/package.c @@ -523,16 +523,15 @@ int _pacman_pkg_filename(char *str, size_t size, const pmpkg_t *pkg) /* Look for a filename in a pmpkg_t.backup list. If we find it, * then we return the md5 or sha1 hash (parsed from the same line) */ -char *_pacman_needbackup(const char *file, const pmlist_t *backup) +char *_pacman_pkg_fileneedbackup(const pmpkg_t *pkg, const char *file) { const pmlist_t *lp; - if(_pacman_strempty(file) || backup == NULL) { - return(NULL); - } + ASSERT(pkg != NULL, RET_ERR(PM_ERR_PKG_INVALID, NULL)); // Should be PM_ERR_PKG_NULL + ASSERT(!_pacman_strempty(file), RET_ERR(PM_ERR_WRONG_ARGS, NULL)); /* run through the backup list and parse out the md5 or sha1 hash for our file */ - for(lp = backup; lp; lp = lp->next) { + for(lp = pkg->backup; lp; lp = lp->next) { char *str = strdup(lp->data); char *ptr; diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h index 287aeb7..06f5f87 100644 --- a/lib/libpacman/package.h +++ b/lib/libpacman/package.h @@ -108,7 +108,7 @@ void *_pacman_pkg_getinfo(pmpkg_t *pkg, unsigned char parm); pmlist_t *_pacman_pkg_getowners(char *filename); int _pacman_pkg_filename(char *str, size_t size, const pmpkg_t *pkg); -char *_pacman_needbackup(const char *file, const pmlist_t *backup); +char *_pacman_pkg_fileneedbackup(const pmpkg_t *pkg, const char *file); #endif /* _PACMAN_PACKAGE_H */ diff --git a/lib/libpacman/remove.c b/lib/libpacman/remove.c index ecfd930..cafec54 100644 --- a/lib/libpacman/remove.c +++ b/lib/libpacman/remove.c @@ -202,8 +202,8 @@ int _pacman_remove_commit(pmtrans_t *trans, pmlist_t **data) int nb = 0; double percent; char *file = lp->data; - char *md5 =_pacman_needbackup(file, pkg_local->backup); - char *sha1 =_pacman_needbackup(file, pkg_local->backup); + char *md5 =_pacman_pkg_fileneedbackup(pkg_local, file); + char *sha1 =_pacman_pkg_fileneedbackup(pkg_local, file); if (position != 0) { percent = (double)position / filenum; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
