Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=8bb58b314bc1993c363d36e39ddb1b9c013685b7
commit 8bb58b314bc1993c363d36e39ddb1b9c013685b7 Author: Michel Hermier <herm...@frugalware.org> Date: Mon Oct 20 13:10:16 2014 +0200 libpacman: Drop explicit refcounting calls (will be replace with implicit refcounting using refcounted_ptr). diff --git a/lib/libpacman/database_cache.cpp b/lib/libpacman/database_cache.cpp index e498ea9..4720fe4 100644 --- a/lib/libpacman/database_cache.cpp +++ b/lib/libpacman/database_cache.cpp @@ -86,7 +86,7 @@ void Database::free_pkgcache() _pacman_log(PM_LOG_DEBUG, _("freeing package cache for repository '%s'"), treename()); - pkgcache.clear(flib::fRelease); + pkgcache.clear(); _pacman_db_clear_grpcache(this); } @@ -105,7 +105,6 @@ int Database::add_pkgincache(package_ptr pkg) return(-1); } - pkg->acquire(); // FIXME: Should not be necessary, but required during migration to refcounted object _pacman_log(PM_LOG_DEBUG, _("adding entry '%s' in '%s' cache"), pkg->name(), treename()); pkgcache.add(pkg); @@ -124,13 +123,9 @@ int Database::remove_pkgfromcache(package_ptr pkg) /* package not found */ return(-1); } - _pacman_log(PM_LOG_DEBUG, _("removing entry '%s' from '%s' cache"), pkg->name(), treename()); - pkg->release(); // FIXME: Should not be necessary, but required during migration to refcounted object - _pacman_db_clear_grpcache(this); - - return(0); + return 0; } static diff --git a/lib/libpacman/db/fakedb.cpp b/lib/libpacman/db/fakedb.cpp index baee4c9..098ac8e 100644 --- a/lib/libpacman/db/fakedb.cpp +++ b/lib/libpacman/db/fakedb.cpp @@ -72,7 +72,6 @@ Package *_pacman_fakedb_pkg_new(const char *name) } free(str); if(dummy->m_name[0] == 0 || dummy->m_version[0] == 0) { - dummy->release(); RET_ERR(PM_ERR_PKG_INVALID_NAME, NULL); } return dummy; diff --git a/lib/libpacman/db/localdb.cpp b/lib/libpacman/db/localdb.cpp index 48b2c6f..95754e2 100644 --- a/lib/libpacman/db/localdb.cpp +++ b/lib/libpacman/db/localdb.cpp @@ -241,7 +241,6 @@ package_ptr _pacman_localdb_pkg_new(LocalDatabase *db, const struct dirent *dire !pkg->set_filename(dname, 0) || pkg->read(inforeq) == -1) { _pacman_log(PM_LOG_ERROR, _("invalid name for dabatase entry '%s'"), dname); - pkg->release(); pkg = NULL; } return package_ptr(pkg); diff --git a/lib/libpacman/db/syncdb.cpp b/lib/libpacman/db/syncdb.cpp index 8e8e35c..30166bd 100644 --- a/lib/libpacman/db/syncdb.cpp +++ b/lib/libpacman/db/syncdb.cpp @@ -141,7 +141,6 @@ package_ptr _pacman_syncdb_pkg_new(SyncDatabase *db, const struct archive_entry !pkg->set_filename(dname, 0) || pkg->read(inforeq) == -1) { _pacman_log(PM_LOG_ERROR, _("invalid name for dabatase entry '%s'"), dname); - pkg->release(); pkg = NULL; } return package_ptr(pkg); diff --git a/lib/libpacman/deps.cpp b/lib/libpacman/deps.cpp index d86d3f1..11b1c0b 100644 --- a/lib/libpacman/deps.cpp +++ b/lib/libpacman/deps.cpp @@ -505,7 +505,6 @@ int pmtrans_t::resolvedeps(FPtrList **data) if(m_handle->ignorepkg.contains(ps->name())) { Package *dummypkg = new Package(miss->target, NULL); QUESTION(this, PM_TRANS_CONV_INSTALL_IGNOREPKG, dummypkg, ps, NULL, &usedep); - dummypkg->release(); } if(usedep) { _pacman_log(PM_LOG_DEBUG, _("pulling dependency %s"), ps->name()); diff --git a/lib/libpacman/kernel/fobject.h b/lib/libpacman/kernel/fobject.h index d2f19e0..feaa0c4 100644 --- a/lib/libpacman/kernel/fobject.h +++ b/lib/libpacman/kernel/fobject.h @@ -45,20 +45,6 @@ public: virtual int set(unsigned val, unsigned long data); }; -static inline void fAcquire(flib::FObject *object) -{ - if(object != nullptr) { - object->acquire(); - } -} - -static inline void fRelease(flib::FObject *object) -{ - if(object != nullptr) { - object->release(); - } -} - } #endif /* FOBJECT_H */ diff --git a/lib/libpacman/kernel/frefcounted.cpp b/lib/libpacman/kernel/frefcounted.cpp index 6789ef5..6be2958 100644 --- a/lib/libpacman/kernel/frefcounted.cpp +++ b/lib/libpacman/kernel/frefcounted.cpp @@ -30,12 +30,11 @@ using namespace flib; refcounted::refcounted() - : m_reference_counter(1) + : m_reference_counter(0) { } refcounted::~refcounted() -{ -} +{ } void refcounted::acquire() const { diff --git a/lib/libpacman/package/fpmpackage.cpp b/lib/libpacman/package/fpmpackage.cpp index b61bb5e..2cd9721 100644 --- a/lib/libpacman/package/fpmpackage.cpp +++ b/lib/libpacman/package/fpmpackage.cpp @@ -225,7 +225,6 @@ Package *_pacman_fpmpackage_load(const char *pkgfile) return(info); error: - info->release(); if(!ret) { archive_read_finish (archive); } diff --git a/lib/libpacman/pacman.cpp b/lib/libpacman/pacman.cpp index af94ec6..eabe836 100644 --- a/lib/libpacman/pacman.cpp +++ b/lib/libpacman/pacman.cpp @@ -866,9 +866,7 @@ int pacman_pkg_free(pmpkg_t *_pkg) ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* Only free packages loaded in user space */ - pkg->release(); - - return(0); + return 0; } /** Compare versions. diff --git a/lib/libpacman/sync.cpp b/lib/libpacman/sync.cpp index 902a44c..cca1420 100644 --- a/lib/libpacman/sync.cpp +++ b/lib/libpacman/sync.cpp @@ -64,18 +64,13 @@ __pmsyncpkg_t::__pmsyncpkg_t() __pmsyncpkg_t::__pmsyncpkg_t(int type, Package *spkg) { this->type = type; - this->pkg_name = spkg->name(); + this->pkg_name = strdup(spkg->name()); m_flags = 0; this->pkg_new = spkg; - fAcquire(this->pkg_new); this->pkg_local = handle->db_local->find(this->pkg_name); - fAcquire(this->pkg_local); } __pmsyncpkg_t::~__pmsyncpkg_t() -{ - fRelease(pkg_new); - fRelease(pkg_local); -} +{ } /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp index 7aa25c5..0576c27 100644 --- a/lib/libpacman/trans.cpp +++ b/lib/libpacman/trans.cpp @@ -399,7 +399,6 @@ int __pmtrans_t::add(const char *target, pmtranstype_t type, int flags, pmsyncpk _pacman_log(PM_LOG_WARNING, _("newer version %s-%s is in the target list -- skipping"), ps->pkg_new->name(), ps->pkg_new->version(), pkg_new->version()); } - fRelease(pkg_new); return 0; } } @@ -432,12 +431,10 @@ add: pmsyncpkg_t *ps = new __pmsyncpkg_t(); ps->type = type; - ps->pkg_name = name; + ps->pkg_name = strdup(name); ps->m_flags = flags; ps->pkg_new = pkg_new; - fAcquire(ps->pkg_new); ps->pkg_local = pkg_local; - fAcquire(ps->pkg_local); ps = add(ps, flags); if(syncpkg != NULL) { @@ -447,7 +444,6 @@ add: return 0; error: - fRelease(pkg_new); return(-1); } @@ -1588,7 +1584,6 @@ int __pmtrans_t::commit(FPtrList **data) type &= ~PM_TRANS_TYPE_REMOVE; } if(pkg_local) { - pkg_local->acquire(); /* we'll need to save some record for backup checks later */ if(!(pkg_local->flags & INFRQ_FILES)) { _pacman_log(PM_LOG_DEBUG, _("loading FILES info for '%s'"), pkg_local->name()); @@ -1803,7 +1798,6 @@ int __pmtrans_t::commit(FPtrList **data) } EVENT(this, trans_event_table[type].post.event, event_arg0, event_arg1); - fRelease(pkg_local); } /* run ldconfig if it exists */ diff --git a/lib/libpacman/trans_sysupgrade.cpp b/lib/libpacman/trans_sysupgrade.cpp index e1094ac..760e0db 100644 --- a/lib/libpacman/trans_sysupgrade.cpp +++ b/lib/libpacman/trans_sysupgrade.cpp @@ -109,12 +109,10 @@ int _pacman_trans_sysupgrade(pmtrans_t *trans) ps = trans->find(spkg->name()); if(ps) { /* found it -- just append to the replaces list */ - lpkg->acquire(); ps->m_replaces.add(lpkg); } else { /* none found -- enter pkg into the final sync list */ ps = new __pmsyncpkg_t(PM_TRANS_TYPE_SYNC, spkg); - lpkg->acquire(); ps->m_replaces.add(lpkg); trans->syncpkgs.add(ps); } _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git