summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2007-11-17 13:06:44 +0100
committerDan McGee <dan@archlinux.org>2007-11-17 09:50:05 -0600
commitc8be7540a50583194e971918099006a1736cfab7 (patch)
treef60c90adfe74a3a30535f0252880fa36b2d6264b /lib/libalpm/db.c
parentd311ad067f47608252b9276df90087db98b1100f (diff)
downloadpacman-c8be7540a50583194e971918099006a1736cfab7.tar.xz
Remove provide.c and provide.h .
This file only contained one private function : _alpm_db_whatprovides . And the public alpm_db_whatprovides was in db.c , so I moved everything there. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: updated POTFILES.in as well] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index f7621338..1e2e6b24 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -43,7 +43,6 @@
#include "util.h"
#include "error.h"
#include "server.h"
-#include "provide.h"
#include "handle.h"
#include "cache.h"
#include "alpm.h"
@@ -780,4 +779,28 @@ pmdb_t *_alpm_db_register_sync(const char *treename)
return(db);
}
+/* return a alpm_list_t of packages in "db" that provide "package"
+ */
+alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package)
+{
+ alpm_list_t *pkgs = NULL;
+ alpm_list_t *lp;
+
+ ALPM_LOG_FUNC;
+
+ if(db == NULL || package == NULL || strlen(package) == 0) {
+ return(NULL);
+ }
+
+ for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
+ pmpkg_t *info = lp->data;
+
+ if(alpm_list_find_str(alpm_pkg_get_provides(info), package)) {
+ pkgs = alpm_list_add(pkgs, info);
+ }
+ }
+
+ return(pkgs);
+}
+
/* vim: set ts=2 sw=2 noet: */