[pacman-dev] [PATCH] Implement AND based package searching.
Xavier Chantry
shiningxc at gmail.com
Thu Jul 24 20:01:55 EDT 2008
This fixes FS#2334.
Signed-off-by: Xavier Chantry <shiningxc at gmail.com>
---
lib/libalpm/db.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 0be81cb..3dfd3bf 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -357,6 +357,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
{
const alpm_list_t *i, *j, *k;
alpm_list_t *ret = NULL;
+ alpm_list_t *list = alpm_list_copy(_alpm_db_get_pkgcache(db));
ALPM_LOG_FUNC;
@@ -367,6 +368,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
if(i->data == NULL) {
continue;
}
+ ret = NULL;
targ = i->data;
_alpm_log(PM_LOG_DEBUG, "searching for target '%s'\n", targ);
@@ -374,7 +376,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
}
- for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
+ for(j = list; j; j = j->next) {
pmpkg_t *pkg = j->data;
const char *matched = NULL;
const char *name = alpm_pkg_get_name(pkg);
@@ -407,6 +409,8 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
}
}
+ alpm_list_free(list);
+ list = ret;
regfree(®);
}
--
1.5.6.4
More information about the pacman-dev
mailing list