diff options
author | Remi Collet <remi@remirepo.net> | 2020-03-12 17:08:41 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-03-12 17:08:41 +0100 |
commit | 6869bee2ad2aa27aa31be800b5117d76b97163b0 (patch) | |
tree | 1f6ee7850f7172b69ec4f7e6dfb901beb844a232 /rpminfo.c | |
parent | 7058acfc1ff69e392ee921e42d4cbf4458c29f1a (diff) |
cleanup
Diffstat (limited to 'rpminfo.c')
-rw-r--r-- | rpminfo.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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) { |