Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=f22b658368b1df3a5e346af8a69d19f871515dbd
commit f22b658368b1df3a5e346af8a69d19f871515dbd Author: Michel Hermier <[email protected]> Date: Tue Oct 21 16:04:56 2014 +0200 libpacman: Remove _pacman_pkg_cmp. diff --git a/lib/libpacman/package.cpp b/lib/libpacman/package.cpp index a1f035c..3b447b3 100644 --- a/lib/libpacman/package.cpp +++ b/lib/libpacman/package.cpp @@ -91,17 +91,6 @@ bool package::set_filename(const char *filename, int witharch) return false; } -/* Helper function for comparing packages - */ -static -int _pacman_pkg_cmp(const package_ptr p1, const package_ptr p2) -{ - package *pkg1 = (package *)p1; - package *pkg2 = (package *)p2; - - return pkg1 == pkg2 ? 0: strcmp(pkg1->name(), pkg2->name()); -} - bool package::is_valid(const pmtrans_t *trans, const char *pkgfile) const { struct utsname name; @@ -340,9 +329,9 @@ bool package::match(const pmdepend_t &depend) } } -bool less<const libpacman::package_ptr>::operator () (const package_ptr pkg1, const package_ptr pkg2) +bool less<package_ptr>::operator () (const package_ptr &pkg1, const package_ptr &pkg2) { - return _pacman_pkg_cmp(pkg1, pkg2) < 0; + return pkg1 < pkg2; } typedef struct FPackageStrMatcher FPackageStrMatcher; diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h index ee51686..f8a6f4b 100644 --- a/lib/libpacman/package.h +++ b/lib/libpacman/package.h @@ -181,12 +181,12 @@ public: template <class T> struct less; template <> - struct less<const package_ptr> + struct less<package_ptr> { - bool operator () (const package_ptr pkg1, const package_ptr pkg2); + bool operator () (const package_ptr &pkg1, const package_ptr &pkg2); }; typedef FList<package_ptr> package_list; - typedef flib::set<libpacman::package_ptr, libpacman::less<const package_ptr>> package_set; + typedef flib::set<libpacman::package_ptr, libpacman::less<package_ptr>> package_set; class PackageMatcher { _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
