summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-09-07 22:39:14 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-09-08 07:50:40 +0300
commit50d70b056e5d97f17434d0456643d3c4ca34c4b6 (patch)
treeb539efc550a6735fb1ee62bf14de234d9b219196
parent03bc9f0f323a1ef7e36d800c7756917203d26b93 (diff)
downloadrpm-50d70b056e5d97f17434d0456643d3c4ca34c4b6.tar.gz
rpm-50d70b056e5d97f17434d0456643d3c4ca34c4b6.tar.bz2
rpm-50d70b056e5d97f17434d0456643d3c4ca34c4b6.zip
Eliminate some dozen redundant rpmcliShowMatches() calls
- Simply call it once at the end, its common for all the cases
-rw-r--r--lib/query.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/lib/query.c b/lib/query.c
index 75c594095..fc44391d3 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -320,8 +320,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_NOTICE,
_("group %s does not contain any packages\n"), arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
break;
case RPMQV_TRIGGEREDBY:
@@ -329,8 +328,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
if (qva->qva_mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package triggers %s\n"), arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
break;
case RPMQV_PKGID:
@@ -353,8 +351,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"pkgid", arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
} break;
case RPMQV_HDRID:
@@ -370,8 +367,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"hdrid", arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
break;
case RPMQV_FILEID:
@@ -396,8 +392,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"fileid", arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
free(digest);
} break;
@@ -415,8 +410,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_NOTICE, _("no package matches %s: %s\n"),
"tid", arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
} break;
case RPMQV_WHATREQUIRES:
@@ -424,8 +418,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
if (qva->qva_mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package requires %s\n"), arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
break;
case RPMQV_WHATPROVIDES:
@@ -435,8 +428,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
if (qva->qva_mi == NULL) {
rpmlog(RPMLOG_NOTICE, _("no package provides %s\n"), arg);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
break;
}
case RPMQV_PATH:
@@ -470,8 +462,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_NOTICE,
_("file %s is not owned by any package\n"), fn);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
fn = _free(fn);
} break;
@@ -491,8 +482,7 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
rpmlog(RPMLOG_ERR,
_("record %u could not be read\n"), recOffset);
res = 1;
- } else
- res = rpmcliShowMatches(qva, ts);
+ }
} break;
case RPMQV_PACKAGE:
@@ -509,7 +499,6 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
res = 1;
} else {
qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_LABEL, arg, 0);
- res = rpmcliShowMatches(qva, ts);
}
break;
}
@@ -518,7 +507,10 @@ static int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
break;
}
- qva->qva_mi = rpmdbFreeIterator(qva->qva_mi);
+ if (qva->qva_source != RPMQV_SPECFILE && qva->qva_mi != NULL) {
+ res = rpmcliShowMatches(qva, ts);
+ qva->qva_mi = rpmdbFreeIterator(qva->qva_mi);
+ }
return res;
}