summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-03-12 17:08:41 +0100
committerRemi Collet <remi@remirepo.net>2020-03-12 17:08:41 +0100
commit6869bee2ad2aa27aa31be800b5117d76b97163b0 (patch)
tree1f6ee7850f7172b69ec4f7e6dfb901beb844a232
parent7058acfc1ff69e392ee921e42d4cbf4458c29f1a (diff)
cleanup
-rw-r--r--rpminfo.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/rpminfo.c b/rpminfo.c
index 88e58b9..3cc5f54 100644
--- a/rpminfo.c
+++ b/rpminfo.c
@@ -390,23 +390,25 @@ PHP_FUNCTION(rpmdbsearch)
rpmtsOpenDB(ts, O_RDONLY);
db = rpmtsGetRdb(ts);
if (useIndex) {
+ /* Simple criterion using index */
di = rpmdbInitIterator(db, crit, name, len);
} else {
/* query all packages */
di = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
+ /* add criterion */
+ if (di) {
+ if (rpmdbSetIteratorRE(di, crit, mode, name)) {
+ php_error_docref(NULL, E_WARNING, "Can't set filter");
+ rpmtsCloseDB(ts);
+ RETURN_FALSE;
+ }
+ }
}
if (!di) {
// Not found
rpmtsCloseDB(ts);
RETURN_FALSE;
}
- if (!useIndex) {
- if (rpmdbSetIteratorRE(di, crit, mode, name)) {
- php_error_docref(NULL, E_WARNING, "Can't set filter");
- rpmtsCloseDB(ts);
- RETURN_FALSE;
- }
- }
array_init(return_value);
while ((h = rpmdbNextIterator(di)) != NULL) {