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

commit 718f15cc96755e645e734125907f73e85dd2fdfd
Author: Michel Hermier <herm...@frugalware.org>
Date:   Mon Oct 27 10:17:43 2014 +0100

libpacman: Use flib::str_set to hold trans::skiplist.

diff --git a/lib/libpacman/db/localdb.cpp b/lib/libpacman/db/localdb.cpp
index ce7590d..83c762b 100644
--- a/lib/libpacman/db/localdb.cpp
+++ b/lib/libpacman/db/localdb.cpp
@@ -48,12 +48,10 @@ using namespace libpacman;

LocalPackage::LocalPackage(LocalDatabase *database)
: package(database)
-{
-}
+{ }

LocalPackage::~LocalPackage()
-{
-}
+{ }

LocalDatabase *LocalPackage::database() const
{
@@ -176,13 +174,7 @@ int _pacman_localpackage_remove(package_ptr pkg, pmtrans_t 
*trans, int howmany,
/* check the "skip list" before removing the file.
* see the big comment block in db_find_conflicts() for an
* explanation. */
-                       int skipit = 0;
-                       for(auto j = trans->skiplist.begin(), end = 
trans->skiplist.end(); j != end; ++j) {
-                               if(!strcmp(file, *j)) {
-                                       skipit = 1;
-                               }
-                       }
-                       if(skipit) {
+                       if(trans->skiplist.contains(file)) {
_pacman_log(PM_LOG_FLOW2, _("skipping removal of %s as it has moved to another 
package"),
file);
} else {
diff --git a/lib/libpacman/kernel/fstr.cpp b/lib/libpacman/kernel/fstr.cpp
index 61df894..b1c2a82 100644
--- a/lib/libpacman/kernel/fstr.cpp
+++ b/lib/libpacman/kernel/fstr.cpp
@@ -115,7 +115,7 @@ void str::reset(const char *s)
if(m_str != nullptr) {
free(m_str);
}
-       m_str = strdup(s);
+       m_str = f_strdup(s);
}

void str::swap(str &o)
diff --git a/lib/libpacman/trans.h b/lib/libpacman/trans.h
index 0cb657b..6b387ee 100644
--- a/lib/libpacman/trans.h
+++ b/lib/libpacman/trans.h
@@ -28,6 +28,7 @@ typedef struct __pmtrans_t pmtrans_t;

#include "kernel/fobject.h"
#include "util/fstringlist.h"
+#include "util/fstrset.h"

namespace libpacman {

@@ -82,7 +83,7 @@ struct __pmtrans_t
unsigned char state;
FStringList targets;
FList<pmsyncpkg_t *> syncpkgs;
-       FStringList skiplist;
+       flib::str_set skiplist;
FStringList triggers;

private:
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to