diff options
-rw-r--r-- | lib/rpmal.c | 11 | ||||
-rw-r--r-- | lib/rpmal.h | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/rpmal.c b/lib/rpmal.c index 8f61c8e64..ca7ab053e 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -564,3 +564,14 @@ rpmalSatisfiesDepend(const rpmal al, const rpmte te, const rpmds ds) } return best; } + +unsigned int +rpmalLookupTE(const rpmal al, const rpmte te) +{ + rpmalNum pkgNum; + for (pkgNum=0; pkgNum < al->size; pkgNum++) + if (al->list[pkgNum].p == te) + break; + return pkgNum < al->size ? pkgNum : (unsigned int)-1; +} + diff --git a/lib/rpmal.h b/lib/rpmal.h index 3c6a833d3..10fe756d4 100644 --- a/lib/rpmal.h +++ b/lib/rpmal.h @@ -80,6 +80,15 @@ rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds); RPM_GNUC_INTERNAL rpmte rpmalSatisfiesDepend(const rpmal al, const rpmte te, const rpmds ds); +/** + * Return index of a transaction element in the available list + * @param al available list + * @param te transaction element + * @return index, (unsigned int)-1 if not found + */ +RPM_GNUC_INTERNAL +unsigned int rpmalLookupTE(const rpmal al, const rpmte te); + #ifdef __cplusplus } #endif |