Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=112d7c1d286433acd77d8e7e1ab58365280a0805

commit 112d7c1d286433acd77d8e7e1ab58365280a0805
Author: Michel Hermier <herm...@frugalware.org>
Date:   Wed Oct 8 09:58:55 2014 +0200

libpacman: Make _pacman_db_remove_pkgfromcache a method of Database.

diff --git a/lib/libpacman/cache.h b/lib/libpacman/cache.h
index 5bdff4e..71c5a74 100644
--- a/lib/libpacman/cache.h
+++ b/lib/libpacman/cache.h
@@ -25,8 +25,6 @@
#include "group.h"
#include "db.h"

-/* packages */
-int _pacman_db_remove_pkgfromcache(libpacman::Database *db, libpacman::Package 
*pkg);
/* groups */
libpacman::Group *_pacman_db_get_grpfromcache(libpacman::Database *db, const 
char *target);

diff --git a/lib/libpacman/database_cache.cpp b/lib/libpacman/database_cache.cpp
index f93dfdd..35f7b5b 100644
--- a/lib/libpacman/database_cache.cpp
+++ b/lib/libpacman/database_cache.cpp
@@ -116,24 +116,23 @@ int Database::add_pkgincache(Package *pkg)
return(0);
}

-int _pacman_db_remove_pkgfromcache(Database *db, Package *pkg)
+int Database::remove_pkgfromcache(Package *pkg)
{
Package *data;

-       ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
if(pkg == NULL) {
return(-1);
}

-       if(!db->pkgcache.remove(pkg, f_ptrcmp, &data)) {
+       if(!pkgcache.remove(pkg, f_ptrcmp, &data)) {
/* package not found */
return(-1);
}

-       _pacman_log(PM_LOG_DEBUG, _("removing entry '%s' from '%s' cache"), 
pkg->name(), db->treename());
+       _pacman_log(PM_LOG_DEBUG, _("removing entry '%s' from '%s' cache"), 
pkg->name(), treename());
data->release(); // FIXME: Should not be necessary, but required during 
migration to refcounted object

-       _pacman_db_clear_grpcache(db);
+       _pacman_db_clear_grpcache(this);

return(0);
}
diff --git a/lib/libpacman/db.h b/lib/libpacman/db.h
index 404a8e4..a786f70 100644
--- a/lib/libpacman/db.h
+++ b/lib/libpacman/db.h
@@ -72,6 +72,7 @@ public:

/* Cache operations */
int add_pkgincache(libpacman::Package *pkg);
+       int remove_pkgfromcache(libpacman::Package *pkg);
void free_pkgcache();

FList<libpacman::Package *> filter(const libpacman::PackageMatcher 
&packagematcher);
diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp
index 8d3687b..6e8849f 100644
--- a/lib/libpacman/trans.cpp
+++ b/lib/libpacman/trans.cpp
@@ -1658,7 +1658,7 @@ int __pmtrans_t::commit(FPtrList **data)
if(pkg_local->remove() == -1) {
_pacman_log(PM_LOG_ERROR, _("could not remove database entry %s-%s"), 
pkg_local->name(), pkg_local->version());
}
-               if(_pacman_db_remove_pkgfromcache(db_local, pkg_local) == -1) {
+               if(db_local->remove_pkgfromcache(pkg_local) == -1) {
_pacman_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache"), 
pkg_local->name());
}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to