summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-07-05 12:49:32 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-07-05 22:16:45 (EDT)
commitbcffa93c4be3ea93d3126cca608e7dc0dcbdca6a (patch)
tree632dab2bd289491fe7ca5eca08ffcdd73e3660e7 /libopkg
parent50ca9f6c7334da63aa416f9302d8cc242167ef04 (diff)
pkg_hash_fetch_installed_by_name_vec: New function
Signed-off-by: P. J. McDermott <pj@pehjota.net>
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/pkg_hash.c22
-rw-r--r--libopkg/pkg_hash.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 4618869..d37ec6a 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -574,6 +574,28 @@ pkg_hash_fetch_installed_by_name_dest(const char *pkg_name, pkg_dest_t *dest)
return NULL;
}
+pkg_vec_t *
+pkg_hash_fetch_installed_by_name_vec(const char *pkg_name)
+{
+ pkg_vec_t *vec, *ret;
+ int i;
+
+ if (!(vec = pkg_vec_fetch_by_name(pkg_name))) {
+ return NULL;
+ }
+
+ ret = pkg_vec_alloc();
+
+ for (i = 0; i < vec->len; i++) {
+ if (vec->pkgs[i]->state_status == SS_INSTALLED
+ || vec->pkgs[i]->state_status == SS_UNPACKED) {
+ pkg_vec_insert(ret, vec->pkgs[i]);
+ }
+ }
+
+ return ret;
+}
+
pkg_t *
pkg_hash_fetch_installed_by_name(const char *pkg_name)
{
diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h
index ed010ef..2f24eb3 100644
--- a/libopkg/pkg_hash.h
+++ b/libopkg/pkg_hash.h
@@ -48,6 +48,7 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(abstract_pkg_t *apkg,
int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata, int quiet);
pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(const char *name);
pkg_t *pkg_hash_fetch_installed_by_name(const char *pkg_name);
+pkg_vec_t *pkg_hash_fetch_installed_by_name_vec(const char *pkg_name);
pkg_t *pkg_hash_fetch_installed_by_name_dest(const char *pkg_name,
pkg_dest_t *dest);